如何解决Redux Persist使用Next.js过期
我想让Redux持续5秒钟过期(我将在以后增加它),当它过期时,将状态更改为INITIAL_STATE
我的redux配置
import { createStore } from 'redux'
import { persistStore,persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage'
const INITIAL_STATE = {
test: 123
}
function reducer(state = INITIAL_STATE,action) {
return state
}
const persistConfig = {
key: '@test',storage,}
const persistedReducer = persistReducer(persistConfig,reducer);
const store = createStore(persistedReducer)
const persistor = persistStore(store);
我尝试使用以下库:https://www.npmjs.com/package/redux-persist-transform-expire-in
但是我有这个问题:https://github.com/sirLisko/redux-persist-transform-expire-in/issues/8
我认为是因为Next.JS
有人知道这样做的库(支持NextJS)吗?或者我自己怎么做
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。