I have a list of objects which I would like to restore when the user is browsing back, so without fetching data from the server. What would be best practice to maintain the state when navigating back? e.g. could I use hooks to maintain the state, should I consider redux or even local storage?
Asked
Active
Viewed 15 times
0
-
1is it an SPA? If yes you can persist state in redux until the `application` is open in the `tab` but you are navigating in the `app` back and forth. `localStorage:` https://stackoverflow.com/questions/8537112/when-is-localstorage-cleared – sonkatamas Sep 06 '20 at 19:35
-
@sonkatamas yes it's a SPA, I was hoping to find a concrete exmple how to do this with the React Context API. – doorman Sep 06 '20 at 20:14
-
1you can do it with `redux` as well, if you are a beginner on this topic I would heavily advise you `redux`. There are a tons of examples out there and the `docs` is pretty good! https://redux.js.org/basics/example – sonkatamas Sep 06 '20 at 20:33