我正在开展一个项目,我需要将最初使用 AsyncStorage 存储的数据迁移到另一个项目: redux-persist-fs-storage

基于此问题:https://github.com/rt2zz/redux-persist/issues/679我已设法以这种方式获取存储在AsyncStorage中的数据:

let persistor = persistStore(store, persistConfig, async () => {
  try {
    console.log("GET ASYNC STATE")
    const asyncState = await getStoredState({
      key: 'root',
      storage: AsyncStorage,
     })
     console.log("ASYNC >>>> " + asyncState )
       if (asyncState) {
     }
   } catch (error) {
    console.warn('getStoredState ASYNC error', error)
  }
});

我正在寻找一种方法将这些数据(asyncState)注入新的fileSystem存储区 .

在第4节中,我们可以使用加压器上的再水化方法来实现这一点 .

fsPersistor.rehydrate(asyncState, { serial: false })

它不是从v4到v5的迁移,只是从一个商店到另一个使用v5 .

在v5中找不到办法 . 关于如何做到这一点的输入将是伟大的:)

干杯