【文件属性】:
文件名称:use-global-hook
文件大小:37KB
文件格式:ZIP
更新时间:2021-04-01 18:29:27
JavaScript
使用全局挂钩
轻松的状态管理,可使用小于1kb的钩子进行响应。
目录
安装:
npm i use-global-hook
或者
yarn add use-global-hook
最小示例:
import React from 'react' ;
import globalHook from 'use-global-hook' ;
const initialState = {
counter : 0 ,
} ;
const actions = {
addToCounter : ( store , amount ) => {
const newCounterValue = store . state . counter + amount ;
store . setState ( { counter : newCounterValue } ) ;
} ,
}
【文件预览】:
use-global-hook-master
----rollup.config.js(3KB)
----yarn.lock(75KB)
----.browserslistrc(131B)
----src()
--------core()
--------plugins()
--------index.js(34B)
----copy-files.js(3KB)
----LICENSE.md(1KB)
----README.md(4KB)
----.editorconfig(252B)
----.gitignore(276B)
----package.json(1KB)