First of all, the basic setting should be similar with or without reaction-to-navigation, as described in the documentation instore.js
import { persistStore, persistCombineReducers } from 'redux-persist'
import storage from 'redux-persist/es/storage'
localStorage if web, AsyncStorage if react-native
import reducers from './reducers'
reducers
const config = {
key: 'root',
storage,
}
const reducer = persistCombineReducers(config, reducers)
function configureStore () {
let store = createStore(reducer)
return store
}
persistStore
, . persistStore
. / . , , () , .
, App.js:
store = configureStore()
registerScreens(store, Provider)
Navigation.startTabBasedApp({
tabs: [{...},]
})
persistStore :
store = configureStore()
persistStore(store, null, () => {
registerScreens(store, Provider)
Navigation.startTabBasedApp({
tabs: [{...},]
})
})
:
v4 config null: persistStore(store, config, callback)