1.0.2 • Published 2 years ago

react-share-states-between-tabs v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Description

Library for share persistent state between tabs or windows without redux using a custom hook

Install

npm install react-share-states-between-tabs

OR

yarn add react-share-states-between-tabs

Usage

Add the react-share-states-between-tabs to your main.js for a global import:

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 (
    <h1>{example}</h1>
  );
}

Documentation

The hook only receives 2 arguments:

/**
 * {String} key name
 * {*} value
 */
const [...] = useShareStatesBetweenTabs(KEY_NAME, VALUE);

SIMPLE 😃

Support

emanuelcastillo9101@gmail.com. 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.

License

MIT License © 2022 Emanuel Castillo

1.0.2

2 years ago

1.0.1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

1.0.0

2 years ago