0.0.2 • Published 1 year ago

neat-state v0.0.2

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

Neat-state

Usage

  1. set a state to the global store
import { neat } from 'neat-state'

const myValueNeat = neat(100)
  1. get a value from the global store
import { neat } from 'neat-state'

const getMyValueNeat = neat((get) => get(myValue))
  1. get a value from promise
import { neat } from 'neat-state'

const promiseDataNeat = neat(() => fetch('url-data').then((res) => res.json()))
  1. use store within components
import { useNeat } from 'neat-state'

const [myValue, setMyValue] = useNeat(myValueNeat)

<>{myValue}</>
0.0.2

1 year ago

0.0.1

1 year ago