Closed robinweser closed 6 years ago
This PR adds a Wrapper component that is a convenient shorthand for the Provider, Consumer pair when working with local state.
const Counter = createStore({ model: 0, actions: { increment: state => state + 1, decrement: state => state - 1, } }) const Tree = () => ( < Counter.Wrapper initialState={5}> {({ state, actions }) => ( <div> <div>{state}</div> <button onClick={actions.increment}>+</button> <button onClick={actions.decrement}>-</button> </div> )} </Counter.Wrapper> )
This PR adds a Wrapper component that is a convenient shorthand for the Provider, Consumer pair when working with local state.