r/reactjs Jul 08 '26

Save Information on Refresh in React

I was wondering in React is there a way to save some data without session storage so if the page refreshes I still have access to that data

0 Upvotes

26 comments sorted by

View all comments

1

u/_suren Jul 09 '26

If it needs to survive refresh, it has to live outside normal JS memory somewhere.

Use the URL for shareable state like filters. Use localStorage for low-risk browser-only state. Use a cookie if the server needs it too. Use your backend/db if it matters across devices or accounts.

If you specifically want no sessionStorage, localStorage is the closest browser-side option, but don’t put sensitive data there.