Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Tweries/useReducerWithLocalStorage
React hook that adds local storage support to the `useReducer` hook
https://github.com/Tweries/useReducerWithLocalStorage
hooks react usereducer
Last synced: about 1 month ago
JSON representation
React hook that adds local storage support to the `useReducer` hook
- Host: GitHub
- URL: https://github.com/Tweries/useReducerWithLocalStorage
- Owner: Tweries
- Created: 2020-04-30T01:25:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-06T00:39:05.000Z (over 4 years ago)
- Last Synced: 2024-07-31T07:15:53.950Z (4 months ago)
- Topics: hooks, react, usereducer
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- fucking-awesome-react-hooks - `useReducerWithLocalStorage`
- awesome-react-hooks-cn - `useReducerWithLocalStorage`
- awesome-react-hooks - `useReducerWithLocalStorage`
- awesome-react-hooks - `useReducerWithLocalStorage`
README
# useReducerWithLocalStorage
React hook that adds local storage support to the `useReducer` hook
## Install
```bash
yarn add use-reducer-with-local-storage
```## Usage
```js
const [state, dispatch] = useReducerWithLocalStorage({
initializerArg: emptyState,
key: 'REACT_APP_STATE',
reducer
});
```## Resources
- [https://gist.github.com/mattiaerre/8dbd2d8efca3f242c7085a9ce82ecbde](https://gist.github.com/mattiaerre/8dbd2d8efca3f242c7085a9ce82ecbde)
- [https://github.com/Tweries/silver-tip/blob/master/src/App.js#L2](https://github.com/Tweries/silver-tip/blob/master/src/App.js#L2)
## Notes
- Special thanks to [Matthew Brooks](https://github.com/mdboop) that was kind enough to review the original Gist and to propose new features.