yarn add react-waterfall
Here is an example of a basic implementation.
import { initStore } from 'react-waterfall'
const store = {
initialState: { count: 0 },
actions: {
increment: ({ count }) => ({ count: count + 1 }),
},
}
const { Provider, connect } = initStore(store)
let Count = ({ count, actions }) => (
<>
{count}
<button onClick={actions.increment}>+</button>
</>
)
Count = connect(state => ({ count: state.count }))(Count)
const App = () => (
<Provider>
<Count />
</Provider>
)
You will find more examples here.
If you want you can use Redux DevTools with react-waterfall
thanks to this middleware.
import { initStore } from 'react-waterfall'
import devtools from 'react-waterfall-redux-devtools-middleware'
const prod = process.env.NODE_ENV === 'production'
export const { Provider, connect } = initStore(store, !prod && devtools())
You can explore types here