使用Redux-Persist和Baqend React / Redux Starter

时间:2017-10-05 02:56:53

标签: react-redux baqend

有谁知道如何添加redux-persist https://github.com/rt2zz/redux-persist 从入门套件到商店:https://www.baqend.com/guide/starter-kits/react/

$archfile = "c:\temp\a1.zip"
# open mode: 1: Create, 2: Update
$archive = [System.IO.Compression.ZipFile]::Open("C:\temp\2.zip", 2)
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($archive, $source, "myfolder\folder2\file.log")

1 个答案:

答案 0 :(得分:0)

我自己还没有尝试过这个,但是来自redux-persist的文档看起来就像你只需添加autoRehydrate并将创建的商店包装在persistStore方法中。 createStoreWithBaqend方法与普通的createStore方法基本相同,但是会向商店添加一些baqend特定的东西。

我会这样试试:

export default (initialState = {}) => {
  const reducer = combineReducers({
    baqend: baqendReducer,
    ...reducers
  })
  const middleware = applyMiddleware(
    ...middlewares
  )
  const store = createStoreWithBaqend(
    db.connect('remarkable-apple-XX', true),
    reducer,
    initialState,
    compose(
      middleware,
      autoRehydrate()
    )
  )
  return persistStore(store)
}

请记住从redux库导入compose。希望这会有所帮助。