ComponentConnector
class ComponentConnector
Builder that connections a React component to the Objective Redux store, allowing the component to use the states and dispatch events.
This provides the React component with an `objectiveStore` prop, which is an instance of the ObjectiveStore connected to the components closest provided ancestor. It also provides props from the states that were added.
As an alternative for functional components, the useObjectiveStore hook can be used to get the ObjectiveStore.
Examples
export default ComponentConnector
.addPropsTo(MyReactComponent)
.fromController(MyStateControllerOne)
.fromController(MyStateControllerTwo, slice => ({ a: slice.a }))
.connect();
connect
public connect(): any
Finishes the builder and provides the connected component.
Returns
fromController
public fromController<StateType, C>(controller: Controller|ModelConstructor<StateController>, selector: StateSelectorFn<ReturnType>|null = null): ComponentConnector
Gets parameters from the specified StateController and injects them into the properties of the component.
Template Parameters
Parameters
Returns
fromState
public fromState(selectorFn: StateSelectorFn<any>): ComponentConnector
Adds a selection of the state to as props to the component.
This method is provided for backward compatibility purposes. For flexibility and performance reasons, it is encouraged that fromController method be used instead of this method when possible.
Parameters
Returns
addPropsTo
public static addPropsTo(component: ComponentClass): ComponentConnector
Starts the builder for a React component.
Parameters