【文件属性】:
文件名称:react-storage-context:React-使用Context API轻松获取和设置本地和会话存储
文件大小:181KB
文件格式:ZIP
更新时间:2021-05-15 18:18:24
JavaScript
React存储上下文
使用React Context API获取并设置本地和会话存储
安装
yarn add react-storage-context
用法
StorageContext
初始化和管理存储,设置StorageContext.Provider的值
import StorageContext from "react-storage-context"
@ StorageContext ( "your-storage-id" )
class App extends PureComponent {
render ( ) {
// children that will read and write storage
}
}
withStorageContext
将提供api作为道具:
local本地存储对象
session会话存储对象
setLocal更新本
【文件预览】:
react-storage-context-master
----.travis.yml(169B)
----.eslintrc(550B)
----example()
--------package.json(575B)
--------.prettierrc(58B)
--------src()
--------public()
--------README.md(103KB)
--------yarn.lock(245KB)
----.babelrc(138B)
----rollup.config.js(608B)
----package.json(2KB)
----.prettierrc(58B)
----src()
--------.eslintrc(97B)
--------index.js(2KB)
--------test.js(4KB)
----tsconfig.json(232B)
----.gitignore(278B)
----README.md(2KB)
----yarn.lock(266KB)
----.editorconfig(147B)