Skip to content

vitorpdasilva/neat-state

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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}</>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published