react-context-hooks-store
A simple global store based on React Context and Hooks
Installation
npm install react-context-hooks-storeoryarn add react-context-hooks-store
Use It
// reducers/common.jslet initialState = theme: 'white'; const reducer = { const type payload = action; };
// store.js; ;; const rootReducer = ;
// src/index.js; const initialValue = {} <Provider rootReducer=rootReducer initialValue=initialValue> <App /></Provider>
// src/pages/movie.js; const Movie = { ; return <div>theme</div> } const mapState = theme; // optionsconst memoPropsAreEqual = { if nextPropsvisible !== prevPropsvisible return false return true}; mapState