@based/use-global-state
v0.2.4
Published
A react hook to make the useState hook global, allowing you to use the same variable anywhere in your project
Downloads
382
Readme
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
}