Easy and react state management based on hooks api.
yarn add @leoooy/eox
npm install @leoooy/eox
You can find the Eox documentation on the website.
/* context.js */
import { createProvider } from 'eox';
const { Provider, Context } = createProvider(reducers, initState);
export { Provider, Context }
/* APP.js */
import { Provider } from 'context.js'
const App = () => {
return (
<Provider>
<Child />
</Provider>
)
}
/* Child.js */
import { withContext } from 'eox';
import { Context } from 'context.js'
const Child = ({dispatch,state}) => {
return <div>
...
</div>
}
export default withContext(Child,Context,{
dispatch: ctx => ctx.dispatch,
state: ctx => ctx.state,
})