Hi, there is any way to persist the data on refresh page? i am looking with no luck, the last resort is asking here. thanks in advance.
You might want to use localstorage if you want to persist data on a page refresh. Especially when dealing with auth tokens. LocalForage is create for this. It uses the available best method for saving to localstorage.
Cookies might be a better shout if you want them on initial request to perform server side renders.
When you use cookies they are attached to the request, whereas local storage requires you wait for the page and javascript to be loaded, parsed and executed then the requests made.
Cookie is better if SSR auth is necessary.
Cookies are the way to go.
https://www.npmjs.com/package/next-cookies might help.
@epileftro85
You can checkout our boilerplate:
https://arefaslani.github.io/next-boilerplate
it's already configured to read and write cookies on server and client. Also it provides many options configured with Next.
@arefaslani i will take a look on it, thanks
Most helpful comment
Cookies are the way to go.
https://www.npmjs.com/package/next-cookies might help.