ractor-react
ractor-react is a hight order component to connect store and react component.
Installation
npm i ractor-react
Document
Provider
A HOC to combine system and stores.You need to use it once when you render the root component:
<Provider system={system} stores={[TodoStore, CounterStore]}>
<App />
</Provider>,
connect
This option we can create a temporary store for we component. The temporary store will mount to system after your component have been mounted and will unmount from system after your component have unmounted.
@connect(TodoStore)(TodoComponent)
Providers
The HOC Providers will connect the global store to our component that have been mounted to system in Provider.
@Providers([
{provide: TodoStore},
{provide: OtherStore, selector?: state => ({data: state.data})}
])