Most React cookie-consent libraries only store a choice in a cookie; they do not stop third-party scripts from loading. ConsentStack ships a React package that blocks trackers until the user consents and gives you hooks to gate your own scripts, with GDPR, CCPA, and 70+ regulations handled for you.
Why ConsentStack on React
- A real consent layer, not just a cookie: third-party scripts are blocked until consent.
- Typed hooks (useConsent, useConsentValue) to conditionally load analytics and marketing code.
- Regulation coverage and geo-detection are handled for you, so you do not maintain rules in your app.
- Pixel-perfect brand matching, so the banner looks built into your React site, never bolted on.
Install in React
npm install @consentstack/reactimport { ConsentStack } from "@consentstack/react"
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<ConsentStack siteKey="YOUR_SITE_KEY" />
</body>
</html>
)
}Replace YOUR_SITE_KEY with the site key from your ConsentStack dashboard.
Render <ConsentStack /> once near the root of your app. Use the useConsent hook to gate analytics or marketing code on a category.
Common questions
ConsentStack's React package blocks third-party scripts until the user consents, rather than only storing a preference. It provides useConsent and useConsentValue hooks and covers GDPR, CCPA, and 70+ regulations without you writing region logic.
Install @consentstack/react, then render the ConsentStack component with your site key near the root of your app. The banner, blocking, and geo-detection are handled for you. Use the useConsent hook to gate your own scripts.
Yes. Read a category with useConsentValue("analytics") or hasConsent("analytics") from useConsent, and only load your analytics code when it returns true.
100+ happy customers
Ship consent on React. In minutes.
Scan your site free to see what is firing before consent, then turn on real blocking from one install.