React hook that adds local storage support to the useReducer
hook
yarn add use-reducer-with-local-storage
const [state, dispatch] = useReducerWithLocalStorage({
initializerArg: emptyState,
key: 'REACT_APP_STATE',
reducer
});
-
https://gist.github.com/mattiaerre/8dbd2d8efca3f242c7085a9ce82ecbde
-
https://github.com/Tweries/silver-tip/blob/master/src/App.js#L2
- Special thanks to Matthew Brooks that was kind enough to review the original Gist and to propose new features.