Creating State
Last updated
Last updated
In ConanJs we advocate for splitting the state in its atomic representation and use as much as possible and to if you need to combine/derive it.
Point to Demo! TBC
To help with this, we provide with two main flavours to create state, Conan.light and Conan.state. You can see the details in the
Is the simplest way to create state.
Conan.light just receives two parameters:
state name: a string used to identify this state
the initial value
You can see this in our demo.
It is the full fledge option to create state, if you have to use this method to create state you will have to pass a StateDef object.
The object is described with detail in its API section , but you will likely be interested in passing to it.
Conan State only with reducers:
Conan State with reducers and action:
You can see how to create a Conan State with reducers in our demo.
You can see how to create a Conan State with reducers and actions in our demo.
1- If possible use Conan.light first. We recommend to have atomic state, and to when needed
2- If you need to create a full fledged ConanState, follow the . Similar to the previous point, we recommend to simplify the states that you create on your application.