How to access client side browser cookies ?
Open in Discord
Black-bellied Whistling-Duck posted this in #help-forum
I want to access cookie in client side components.
View full answer
Answered by joulev & fuma pray for Schneider
joulev & fuma pray for Schneider
any cookie library will work
If I use
document.cookie method then I get document is not defined error.
Client components are still pre rendered on the server so you'll need to make sure you check that document exists and/or have it in a useEffect or event handler