0.2.4 • Published 2 years ago

@based/use-global-state v0.2.4

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

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
}