@yashmahalwal/react-synced-state
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

React Synced State

License TypeScript

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 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"
    }
}

Running tests

Tests can be run by using jest:

npm run test

Developing 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 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.

Building Code

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.

License

This project is licensed under the MIT License


Package Sidebar

Install

npm i @yashmahalwal/react-synced-state

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

24.7 kB

Total Files

13

Last publish

Collaborators

  • yashmahalwal