Schemas And Persistence
These guides discuss how to set up a ValuesSchema
or TablesSchema
on a Store
so that certain structures of data are assured - and how to load and save data to a Store
from a persistence layer.
See also the Countries demo, the Todo App demos, and the Drawing demo.
Using Schemas
Schemas are a simple declarative way to say what data you would like to store.
Schema-Based Typing
You can use type definitions that infer API types from the schemas you apply, providing a powerful way to improve your developer experience when you know the shape of the data being stored.
Mutating Data With Listeners
Although listeners are normally prevented from updating data, there are times when you may want to - such as when you are programmatically checking your data as it gets updated.
Persisting Data
The persister module lets you save and load Store
data to and from different locations, or underlying storage types.
Custom Persistence
When you want to load and save Store
data in unusual or custom ways, you can used the createCustomPersister
function to do so in any way you wish.
Database Persistence
Since v4.0, there are various options for persisting Store
data to and from SQLite databases, via a range of third-party modules.
Synchronizing Data
Some persister modules let you save and load Store
data to underlying storage types that can provide synchronization, local-first reconciliation, and CRDTs.