-
Notifications
You must be signed in to change notification settings - Fork 1
Home
npm install redu
Redu is comprised of just two functions: createStore(Component)
, and createSubscriber(Component, toProps)
.
Creates and returns a StoreComponent
wrapped around the supplied Component
.
A React.Component
that wraps another, and houses your application-level state. Because it is simply a regular React component, you have access to all the usual React component API's (e.g. StoreComponent.defaultProps
), in addition to the following provided by Redu:
Setting this property with an object will provide the StoreComponent
with its initial state. The StoreComponent's
state will be made available to SubscriberComponents
via the toProps
function.
Setting this property with an object of functions will provide the StoreComponent
with action functions that will be bound to the StoreComponent instance when it is created. These actions will be made available to SubscriberComponents
via the toProps
function.
This property will return the Component
that was wrapped by createStore(Component)
. It is not directly settable.
Creates and returns a SubscriberComponent
wrapped around the supplied Component
.
Gives you access to the StoreComponent's
state, props, and actions. It must return an object, which will be passed into the SubscriberComponent
as props.
A React.Component
that wraps another, and can derive props from its ancestor StoreComponent's
state, props, and action functions. Similar to StoreComponent
, it also has the following:
This property will return the Component
that was wrapped by createSubscriber(Component, toProps)
. It is not directly settable.
Next: Basic Example