@based/use-global-state

0.2.4 • Public • Published

useGlobalState

works like useState but then with a key that can be used globally.

import useGlobalState from '@based/use-global-state'

const MyComp = () => {
  const [count, setCount] = useGlobalState('counter')
  
  return <div onClick={()=>setCount(Math.random())}> Hello {count}</div
}

Package Sidebar

Install

npm i @based/use-global-state

Weekly Downloads

38

Version

0.2.4

License

MIT

Unpacked Size

2.02 kB

Total Files

3

Last publish

Collaborators

  • luiguild
  • nfrade
  • kylemarch513
  • framma
  • olliv
  • youzid
  • rase-
  • saulx