redux-persist
redux-persist copied to clipboard
Blank White Screen After Adding Persist - Used with Redux Toolkit Query (React Native)
Hello Devs.
I tried adding redux persist to my application, followed all the guidelines, however, it shows blank white screen, Please I am lost of idea, solution...
My Stack is "expo": "^45.0.5", "react-redux": "^8.0.2", "redux": "^4.2.0", "redux-persist": "^6.0.0",
Below is my store.js
const preloadedState = { auth: { user: false, showWallet: false, accessToken: null } }
const persistConfig = { key: 'root', storage: AsyncStorage, version: 1, whitelist: ['auth'], blacklist: [apiSlice.reducerPath], stateReconciler: autoMergeLevel2, }
const reducers = { [apiSlice.reducerPath]: apiSlice.reducer, [authSlice.name]: authReducer, }
const combinedReducer = combineReducers(reducers);
export const rootReducer = ( state, action ) => { if( action.type === RESET_STATE_ACTION_TYPE ) { state = {} } return combinedReducer(state, action) }
const persistedReducer = persistReducer(persistConfig, combinedReducer)
const store = configureStore({ reducer: persistedReducer, middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: { ignoredActions: [FLUSH, REHYDRATE,PAUSE, PERSIST, PURGE, REGISTER] } }).concat([ unauthenticateMiddleware, apiSlice.middleware, ]), preloadedState: preloadedState })
export default store;
And on my App.js
<Provider store={store}> <PersistGate loading={null} persistor={persistor}> <Routes /> <FlashMessage position="top" /> </PersistGate> </Provider>
If I removed the <PersistGate .../> my app will be fine Please is there anything I am missing here.
PS: No error message.
what an ugly issue format
I had the same problem. This was due to the fact that I didn't configure any persist actions