【文件属性】:
文件名称:use-global-hook:使用Hooks和Context API进行React的无痛全局状态管理,大小为1KB!
文件大小:165KB
文件格式:ZIP
更新时间:2021-05-06 09:24:49
react global-hooks context-api react-hooks hook-store
使用全局挂钩
使用Hooks和Context API进行React的无痛全局状态管理,大小为1KB!
安装
npm install @devhammed/use-global-hook
快速范例
import React from 'react'
import ReactDOM from 'react-dom'
import { GlobalHooksProvider , createGlobalHook , useGlobalHook } from '@devhammed/use-global-hook'
const store = createGlobalHook ( /** 1 **/ 'counterStore' , ( ) => {
const [ count , setCount ] = React . useState ( 0 )
const increment =
【文件预览】:
use-global-hook-master
----rollup.config.js(432B)
----.github()
--------workflows()
----src()
--------index.js(3KB)
----babel.config.js(167B)
----example()
--------index.html(361B)
--------index.css(852B)
--------index.js(1KB)
----README.md(11KB)
----index.d.ts(6KB)
----.gitignore(38B)
----package-lock.json(748KB)
----package.json(1KB)