devhammed / use-cookie

Get, Set, Update and Delete Cookie using React Hooks.
https://hammed.dev/use-cookie/
17 stars 2 forks source link

cookie value not updated on external cookie change #1

Open raDiesle opened 5 years ago

raDiesle commented 5 years ago

Hi,

What I did: update cookie in browser cookie settings with another value. Value is not reflected in example ui, but on page reload

devhammed commented 4 years ago

Hello @raDiesle,

Yeah, you have to reload the page for it to capture the browser value. This feature you are requesting for requires watching the browser cookie value and syncing with the React state. Though, the initial plan is to hydrate the browser value on page load then only sync updates from React state to Browser. I will see what I can do.

Thanks for using!

devhammed commented 4 years ago

Screenshot from 2020-01-06 08-57-26

I am already working on your feature request, don't know if using setInterval is the best for the job though.

Do you have a better suggestion?