Created
March 6, 2017 22:40
-
-
Save jwill9999/cef2b161265edfba6b31af808260fc2f to your computer and use it in GitHub Desktop.
React Local storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialState = (localStorage["redux-store"]) ? | |
JSON.parse(localStorage["redux-store"]) : | |
sampleData | |
const saveState = () => | |
localStorage["redux-store"] = JSON.stringify(store.getState()) | |
// createStore here | |
store.subscribe(saveState) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment