Hoodux
Hoodux is a helper to replace the React Redux with React hooks.
Usage
Install
$ npm install hoodux --save or $ yarn add hoodux
API
useHooduxProvider(reducer, initState)
This is a hook to generate Hoodux Provider which should be placed on the top level of app. Hoodux provider will populate a state and dispatch to the app's components tree.
useHoodux()
This is a hook to pop a state and dispatch to use in any component in your app.
Example
; const initState = isSignedIn: false count: 0; const reducer = { }; const App = { const HooduxProvider = ; return <HooduxProvider> <Main /> </HooduxProvider> ;}; const Main = { const state dispatch = ; return <div> <button onClick= >Toggle</button> <button onClick= > Change count to 5 </button> </div> ;};
Next to do
- Add more types