Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emanueljcc/react-share-states-between-tabs
Library for share persistent state between tabs without redux using a custom hook
https://github.com/emanueljcc/react-share-states-between-tabs
css3 customhooks gh-pages hook jsx library npm react states storage yarn
Last synced: about 2 hours ago
JSON representation
Library for share persistent state between tabs without redux using a custom hook
- Host: GitHub
- URL: https://github.com/emanueljcc/react-share-states-between-tabs
- Owner: emanueljcc
- Created: 2022-04-02T19:46:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-04T05:25:40.000Z (over 2 years ago)
- Last Synced: 2024-10-13T10:57:23.264Z (24 days ago)
- Topics: css3, customhooks, gh-pages, hook, jsx, library, npm, react, states, storage, yarn
- Language: JavaScript
- Homepage: https://emanueljcc.github.io/react-share-states-between-tabs/
- Size: 1.38 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
React share states between tabs (custom hook) 🚀## Description
Library for share persistent state between tabs or windows without redux using a custom hook## Install
```bash
npm install react-share-states-between-tabs
```
OR
```bash
yarn add react-share-states-between-tabs
```## Usage
Add the react-share-states-between-tabs to your main.js for a global import:```javascript
import React from 'react'import useShareStatesBetweenTabs from 'react-share-states-between-tabs'
const App = () => {
const [example, setExample] = useShareStatesBetweenTabs('example', 'iam example');// You can also use separately if you wish.
// const [example,] = useShareStatesBetweenTabs('example');
// const [, setExample] = useShareStatesBetweenTabs('example');const handle = (data) => setItems(data);
return (
{example}
);
}
```## Documentation
The hook only receives 2 arguments:```javascript
/**
* {String} key name
* {*} value
*/
const [...] = useShareStatesBetweenTabs(KEY_NAME, VALUE);
```
SIMPLE 😃## Support
[email protected].
You can also send me a direct message on twitter
@emanueljcc.## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.## Collaborators
Made with [contrib.rocks](https://contrib.rocks).
## License
[MIT](https://choosealicense.com/licenses/mit/) License © 2022 [Emanuel Castillo](https://github.com/emanueljcc)