React store built on top of the new context API
store.js
import createStore from 'react-waterfall'
const config = {
initialState: { count: 0 },
actionsCreators: {
increment: ({ count }) => ({ count: count + 1 }),
},
}
export const { Provider, connect, actions } = createStore(config)
App.js
import { connect, Provider, actions } from './store'
let Count = ({ count }) => count
Count = connect(({ count }) => ({ count }))(Count)
const App = () => (
<Provider>
<Count />
<button onClick={actions.increment}>+</button>
</Provider>
)
During development redux-devtools
are automatically enabled. Install the extension.
https://github.com/didierfranc/react-waterfall/graphs/contributors