A simple utility to synchronise state updates across your React app.
For detailed documentation and API reference, please visit our official documentation. This readme page contains the instructions for setting up the code locally and maintaining it.
To work with the code, start by cloning the repository on your local machine. To set up dependencies, run
npm install
React is a peer dependency of the hook. Since it relies on Providers
and simple useState
and useEffect
, this package can work with any version of React from v16
.
However, documentation is written using React v18
. If you wish to to work with documentation, please ensure v18
is installed.
{
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
}
Tests can be run by using jest:
npm run test
Source code for documentation is kept under docs-source
. Examples for the documentation are used for test cases. Documentation is bundled using parcel
. To run the development server for documentation,
npm run docs
To build a static version of the documentation, run
npm run docs:build
This generates the artifacts under docs
folder. The relative path for documentation is /react-synced-state
since the repository is hosted on github pages which are accessed by url of the form <username>.github.io/<repo-name>
. So simply running a http
server might not be enough to host the build locally.
Code can build for distribution by running
npm run build
This creates a distribution build under build
. Code is transpiled down to javascript
with es module
imports.
This project is licensed under the MIT License