React native Redux persist不存储任何数据供脱机使用

React native Redux persist不存储任何数据供脱机使用,react-native,redux,react-redux,redux-thunk,redux-persist,React Native,Redux,React Redux,Redux Thunk,Redux Persist,我正在使用redux,redux persist和中间件redux thunk 获取Json 应用程序编程接口。。 我的问题是,当wifi关闭时,我无法再使用它。。 离线使用时,存储无法正常工作 也许您忘了从configureStore.js调用导出的函数 在应用程序入口点内调用它。 我认为在这一点上,redux persist库的文档记录很差,因为您可以在问题选项卡中找到大多数解决方案 这对我有用: import React,{Component}来自'React'; 从“/logo.svg

我正在使用redux,redux persist和中间件redux thunk 获取Json 应用程序编程接口。。 我的问题是,当wifi关闭时,我无法再使用它。。 离线使用时,存储无法正常工作


也许您忘了从
configureStore.js
调用导出的函数

在应用程序入口点内调用它。 我认为在这一点上,redux persist库的文档记录很差,因为您可以在问题选项卡中找到大多数解决方案

这对我有用:

import React,{Component}来自'React';
从“/logo.svg”导入徽标;
导入“/App.css”;
//贮藏
从'react redux'导入{Provider};
从'redux persist/integration/react'导入{PersistGate};
从“/configureStore.js”导入configureStore;
//调用你的商店配置
const{persistor,store}=configureStore();
类应用程序扩展组件{
render(){
返回(
应用程序
);
}
}
导出默认应用程序
 Here is my codes.

 Store.js 
 -------------
import { createStore, applyMiddleware, compose } from 'redux';
import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/es/storage';
import thunk from 'redux-thunk';
import rootReducer from './RootReducers';

const middleware = [thunk];
const persistConfig = {
  key: 'root',
  storage
};

const persistedReducer = persistReducer(persistConfig, rootReducer);


const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const enhancers = composeEnhancers(
  applyMiddleware(...middleware),
);

export default () => {
  const store = createStore(persistedReducer, enhancers)
    const persistor = persistStore(store);
  return { store, persistor: persistor };
};