Getting Started
Learn how to set up your first Saphyra store
Reading state
A Saphyra store is a plain JavaScript object instance. To integrate it with the React lifecycle, you need to use hooks to translate the store state into React state.
Saphyra provides a helper called createStoreUtils
, which generates many useful hooks and utilities to make this integration a breeze.
Writting state
Use setState
for non-critical updates, such as UI state changes from color pickers, control form inputs, etc.
Providing with Context
The CountStore
module exposes a Context
component that you can use to provide the store state to children. It also provides a hook called useStore
to consume the context.
We're all set up
That's pretty much it. Every feature you want to add to your app should look like this at first.
These are the basic concepts. Now, let's explore what makes Saphyra unique and powerful.