kedge:易于使用的React全局状态钩子

时间:2021-05-07 21:57:29
【文件属性】:
文件名称:kedge:易于使用的React全局状态钩子
文件大小:64KB
文件格式:ZIP
更新时间:2021-05-07 21:57:29
JavaScript 楔子 易于使用的React全局状态挂钩。 安装 npm install kedge 用法 import { createStore, useStore } from 'kedge'; const priceStore = createStore(); function PriceComponent() { const price = useStore(priceStore); useEffect(fetchPrice, []); return (
Price: { price }
); } function fetchPrice() { priceStore.set(73); } 原料药 const store = createStore(initialState, optionalName) 创建具有初始值
【文件预览】:
kedge-master
----.gitignore(35B)
----.babelrc(48B)
----package.json(740B)
----package-lock.json(271KB)
----src()
--------index.js(790B)
----.travis.yml(50B)
----LICENSE(1KB)
----CHANGELOG.md(348B)
----__tests__()
--------kedge.test.js(2KB)
----README.md(2KB)
----.npmignore(39B)

网友评论