buildo / react-cookie-banner

React Cookie banner which can be automatically dismissed with a scroll. Because fuck The Cookie Law, that's why.
http://react-components.buildo.io/#cookiebanner
MIT License
182 stars 19 forks source link

Component only return null #49

Closed ghost closed 6 years ago

ghost commented 6 years ago

I like to use this with gatsby (they use still react 0.15.x), but I can't get its working. The code is in src/layout/index.js - It's a child of the main Container. I've tried also to add a <div> wrapper.

I can see the component with the chrome developer react extension, but it doesn't render anything, it just returns null. I saw the package.js like to have react ^0.16 so I've downgraded to react-cookie-banner v0.0.18. But still exactly same, nothing. Any idea?

FrancescoCioria commented 6 years ago

This component saves in a cookie if the user has already accepted your cookie policy and, in that case, it renders null. Also, by default, a simple scroll is interpreted as "accepting" cookie policy.

My guess is you already accepted it and therefore are not seeing it anymore.

The cookie string used by default is "accepts-cookies", try deleting it and tell me if finally renders.

PS: react-cookie-banner exports a library to help you manipulate cookies, you can read more about it in the readme: https://github.com/buildo/react-cookie-banner#cookies-manipulation