@ComponentState decorator
Is used to inject actions into component
When component is created @ComponentState
decorator creates does two things:
Creates instance of state actions
Assigns values to
statePath
andstateIndex
taken from props
Component state takes 1 parameter but it can be either action class or function that resolves action class:
@ComponentState(TodosStateActions)
or
@ComponentState((component: TodosComponent) => {
return component.isStateA
? A_StateActions
: B_StateActions;
})
Last updated
Was this helpful?