1.0.1 • Published 1 year ago

usegstate v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

usegstate

The simplest way to create Global States.

NPM JavaScript Style Guide

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

1.0.1

1 year ago

1.0.0

1 year ago