Getting started
SyncState is a document-based state management library for React and JS apps.
In a SyncState store, all your data is contained in a single document. SyncState is based on JSON patches and uses these patches to update the document.
While SyncState can very well be used as a general purpose state management solution, we created it to make it easy to build realtime multi-user, undoable apps.
#
InstallationYou can install @syncstate/core
for the core functionality from NPM.
The recommended way to use SyncState with React is to use @syncstate/react
.
Both packages are available as CJS as well as ESM packages.
#
Basic examplesNote: All the examples are based on SyncState with React. For usage without react, refer this
SyncState maintains a single state tree for your data just like Redux. But instead of reducers, it works on mutator functions (which generate JSON patches). We'll start with a basic example and learn the concepts as we go.
#
Counter example#
Todo exampleFor a more complete example refer Todo example codesandbox
You can explore SyncState further: