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 (将#修改为@)