Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs localfough.clear()未清除我的web数据库_Reactjs_React Redux_Localforage - Fatal编程技术网

Reactjs localfough.clear()未清除我的web数据库

Reactjs localfough.clear()未清除我的web数据库,reactjs,react-redux,localforage,Reactjs,React Redux,Localforage,我正在使用react-redux、redux-presist和LocalFlow制作计数器 并尝试清除我的存储以设置cnt=0当用户进来时,当用户进入我的网站时,它将从0开始计数到n,但是clear()没有任何想法 store.js 从“redux”导入{createStore}; 从“redux persist”导入{persistStore,persistReducer}; 从“localfollow”导入存储; 从“/rootReducer”导入{rootReducer}; export

我正在使用react-redux、redux-presist和LocalFlow制作计数器

并尝试清除我的存储以设置
cnt=0当用户进来时,当用户进入我的网站时,它将从0开始计数到n,但是
clear()
没有任何想法

store.js

从“redux”导入{createStore};
从“redux persist”导入{persistStore,persistReducer};
从“localfollow”导入存储;
从“/rootReducer”导入{rootReducer};
export const localStorageEngine=storage.createInstance({
名称:“水族”,
版本:1,,
description:“为AQUA声明DB”,
驱动程序:[存储。本地存储]
});
//localStorageEngine.clear();
常数persisConfig={
键:“根”,
存储
};
const persistedReducer=persisreducer(persisConfig,rootReducer);
const store=createStore(persistedReducer);
导出默认存储;
export const persistor=persistStore(存储);
App.js

import React,{useffect}来自“React”;
从“/store”导入存储,{localStorageEngine};
导入“/styles.css”;
从“/rootReducer”导入{setCounter};
导出默认函数App(){
useffect(()=>{
localStorageEngine.clear()。然后(()=>console.log(“清除”);
设置间隔(()=>{
dispatch(setCounter(store.getState().counterReducer.cnt+1));
log(store.getState().counterReducer.cnt);
}, 1000)
//组件将卸载
return()=>{
localStorageEngine.clear()。然后(()=>console.log(“在componentWiilUnmount时清除”);
}
}, []);
返回;
}

如果你需要更多信息,请告诉我