1.0.3 • Published 3 years ago
state-manager-react v1.0.3
state-manager-react
What is this?
Sometimes state managing with Redux gets overwhelming but with state-manager-react you can make it easy. Before I show you examples, I want to list some points when to use state-manager-react
and when to use Redux
.
- Promises/AsyncAwait - use Redux
- Simple State - use state-manager-react
- Form data gathering - use state-manager-react or Hooks
Why to use it?
Redux takes so much configuration but state-manager-react doesn't just write your state, wrap the Provider and get started.
Examples
Making state:
const { mainState, updateState, getRawState } = stateHandler({people: 1, name: "Haider"})
updateState({name: "React"})
console.log(mainState)
console.log(getRawState("name"))
Adding it to React
import { Provider } from
return (
<Provider value={mainState}>
...
</Provider>
)