reactjs - 状态获取不保存刷新反应本机博览会
问题描述
当我的应用程序刷新时,它不会保存状态,但是当我创建另一个习惯时,即保存状态,并且我想在更新习惯或状态的任何部分发生更改时保存状态:
export const rootReducer = combineReducers({
habitListReducer,
progressRefreshReducer,
currentDateReducer,
statisticsReducer,
productiveDayReducer,
habitCategoryReducer,
habitsColorReducer,
})
const persistConfig = {
key: "root",
storage: AsyncStorage,
}
const persistedReducer = persistReducer(persistConfig, rootReducer)
const store = createStore(persistedReducer)
const persistedStore = persistStore(store)
export default function App() {
return (
<Provider store={store}>
<PersistGate persistor={persistedStore} loading={null}>
<NavigationContainer>
<BottomTab />
</NavigationContainer>
</PersistGate>
</Provider>
)
}
解决方案
推荐阅读
- unity3d - Forge AR/VR Toolkit 无法在 Unity 中获取场景
- mongodb - 具有 $text 搜索的 MongoDB $match 块中的顺序是否重要?
- rest - 您将如何设计一个包含 POST 模拟的 REST API?
- python - 如何更改日期格式并在 mongodb 查询过滤器中连接字符串匹配?
- javascript - 在单独的 js 文件中处理所有带有前缀的路由
- python-3.x - 如何在没有 shell 脚本(.sh)的情况下从 python 脚本(.py)激活虚拟环境?
- c++ - 分离并打印出偶数和奇数随机数
- python - 在 Python / Pandas /Excel 中为每个 ID 查找 2 个不同表的重叠日期
- android - 单击时通知未重定向
- javascript - 映射网格但在css动画reactjs中具有每个节点延迟