@yashmahalwal/react-synced-state
v1.0.5
Published
A react hook to synchronise state updates
Downloads
14
Maintainers
Readme
React Synced State
Overview
A simple utility to synchronise state updates across your React app.
Documentation
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.
Table of Contents
Installing dependencies
To work with the code, start by cloning the repository on your local machine. To set up dependencies, run
npm installReact 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"
}
}Running tests
Tests can be run by using jest:
npm run testDeveloping documentation
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 docsTo build a static version of the documentation, run
npm run docs:buildThis 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.
Building Code
Code can build for distribution by running
npm run buildThis creates a distribution build under build. Code is transpiled down to javascript with es module imports.
License
This project is licensed under the MIT License
