Save all of the game info to local storage. In this case high score could be added the game state object in the gameReducer. Using this method you'd be able to save the entire game and return to a game in progress. The downside might be performance since local storage is synchronous. Performance issues might be handled by throttling.
Save only high scores. Follow the guide to set up local storage. Add a new property on state to hold the high score. You need only update and save the score when the score changes.
In either case the high score can be saved to on the game state object in the reducer along with all of the other game data. An alternative would be to create a new reducer just for high scores and save the data there. This would require a new reducer and that reducer would need to be added to the root reducer. The advantage to this might be simplified state management.
It would be great of the game saved high scores and other data to local storage.
Follow the guide here: https://github.com/MakeSchool-Tutorials/web-7-react-redux-timers-app/blob/master/P10-Persisting-Timers/content.md
There are a couple approaches to take.
gameReducer
. Using this method you'd be able to save the entire game and return to a game in progress. The downside might be performance since local storage is synchronous. Performance issues might be handled by throttling.In either case the high score can be saved to on the game state object in the reducer along with all of the other game data. An alternative would be to create a new reducer just for high scores and save the data there. This would require a new reducer and that reducer would need to be added to the root reducer. The advantage to this might be simplified state management.