1.0.1 • Published 1 year ago
usegstate v1.0.1
usegstate
The simplest way to create Global States.
Install
npm install --save usegstate
Usage
Create Global State
import { gState } from 'usegstate'
const myGlobalState = gState('hello-world!')
Use Global State
import useGState from 'usegstate'
const GenderGetter = () => {
const [gState,setGState] = useGState(myGlobalState)
return (
<div>{gState}</div>
)
}
Don't forget to wrap your app inside GStateProvider
import {GStateProvider} from 'usegstate'
const Wrapper = () => {
return (
<GStateProvider>
<YourWonderfullApp />
</GStateProvider>
)
}
License
MIT © amit231