yarn add react-waterfall
Here is an example of the simplest implementation.
import { initStore } from 'react-waterfall'
const store = {
initialState: { count: 0 },
actions: {
increment: ({ count }) => ({ count: count + 1 }),
},
}
const { Provider, connect } = initStore(store)
let Count = ({ state, actions }) => (
<>
{state.count}
<button onClick={actions.increment}>+</button>
</>
)
Count = connect(['count'])(Count)
const App = () => (
<Provider>
<Count />
</Provider>
)
You can explore types here
Advanced examples are available here