【发布时间】:2021-05-23 22:13:14
【问题描述】:
我正在为我的 react native 应用程序使用 ignite bowser 样板。它使用 mobx-state-tree 进行状态管理。每次我重新启动我的应用程序时,它都会重置商店。有什么办法可以持久存储在 ignite bowser 中?
【问题讨论】:
-
Ignite Bowser 设置为 initialize the store with the data that is already stored in
AsyncStorage和 it puts the data inAsyncStorageon every MST state change。您确定将数据保存在存储中,而不是本地 React 组件状态或类似状态吗? -
已修复,需要从 utils 文件中的 '@react-native-async-storage/async-storage' 导入 AsyncStorage。
标签: react-native mobx-react mobx-state-tree mobx-persist