@icraft/store
v0.0.4
Published
@icraft/store
Downloads
103
Readme
@icraft/store
This is a general and very, very easy to use data flow management tool
Install
pnpm i @icraft/store -SUsage
// create a store in any where
import { Store } from '@icraft/store'
const store = new Store({
count:0,
name:'name'
})
// set state in any where
store.setState({
count:1,
name:'new name'
})
// use the store in component
import { useStore } from '@icraft/store'
const [{count,name},setState] = useStore(store,['count','name'])
// update state in component
const handleClick = () => {
setState({
count:count+1,
})
}
LICENSE
MIT license.
