react-use-sync
React hook for synchronized values between windows
Install
Install with npm:
npm install react-use-sync
Or with yarn:
yarn add react-use-sync
Usage
To sync state between tabs, wrap a React Hook that returns a function with the useState
signature (i.e. [value, setValue]
).
import React useState from 'react'import useSync from 'react-use-sync' { const count setCount = ); return <div> <p>The count is count</p> <button => Click me! </button> </div> }
Run tests
npm run test
Or:
yarn test
Author
👤 Mehdi Vasigh mehdivasigh@gmail.com
- Twitter: @mehdi_vasigh
- Github: @mvasigh
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Show your support
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator