Tweries / useReducerWithLocalStorage

React hook that adds local storage support to the `useReducer` hook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useReducerWithLocalStorage

React hook that adds local storage support to the useReducer hook

Install

yarn add use-reducer-with-local-storage

Usage

const [state, dispatch] = useReducerWithLocalStorage({
  initializerArg: emptyState,
  key: 'REACT_APP_STATE',
  reducer
});

Resources

Notes

  • Special thanks to Matthew Brooks that was kind enough to review the original Gist and to propose new features.

About

React hook that adds local storage support to the `useReducer` hook


Languages

Language:JavaScript 100.0%