Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        


React share states between tabs (custom hook) 🚀







View Demo

## 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)