#Cookies to Context

4 messages · Page 1 of 1 (latest)

sacred mango
#

how to get values from cookie and set to application using Context ?

I tried using routeLoader$, server$, onGet and OnRequest. But I cannot able to set to useContextProvider.

Please help.

remote grail
#

You would use those things to return the cookie value and then inside the component set the value to a context. You can use useContextProvider inside of those functions.

smoky aurora
#

An alternative is to have the server set a cookie which is JS readable. Than the JS can read it anywhere in your codebase.