react-cookie-guard
v1.0.0
Published
Manages cookie consent in React applicatoins with this component.
Maintainers
Readme
React Cookie Guard
Manages cookie consent in React applications with this component.
Usage
To start using the library, install it in your project:
npm install react-cookie-guardAdd to your app, it will be the place where banner will be rendered.
import { CookieGuardBanner } from "react-cookie-guard"
// ...
function App() {
const handleAccept = () => {
// Do something when accept cookies
console.log("Accept")
}
const handleReject = () => {
// Do something when reject cookies
console.log("Reject")
}
return (
<>
<CookieGuardBanner
data-testid="cookieBanner"
lang='en'
configCookies='cookies'
learnMore='policy'
handleAccept={handleAccept}
handleReject={handleReject}/>
</>
)
}
export default AppTranslations
Bases on Astro i18n oficial documentation. Learn more
