Components with Actions
Next we need to tell component that it will use TodoActions
. We are doing this by decorating component with @ComponentState
decorator
or if you do not like provided base class you can do this
In this step three properties will be available from base class
statePath - current state path that component is manipulating with
actions - previously created actions class
stateIndex - index item of the state if state is an array.
For example if we are iterating through todos
and repeating repeating todo.component
we need to pass not only statePath
but stateIndex
as well because statePath
is todos
and stateIndex
will be n
So final path inside of todo.component
will look like todos[stateIndex]
Last updated
Was this helpful?