How to persist redux store using redux toolkit Part 2

npm install redux-persist or yarn add redux-persist

2. install AsyncStorage

3.configure store:

import AsyncStorage from ‘@react-native-async-storage/async-storage’;

import rootReducers from ‘app/store/slice’;

import { configureStore } from ‘@reduxjs/toolkit’;

import React from ‘react’

import { Provider, useSelector } from ‘react-redux’;

import { PersistGate } from ‘redux-persist/es/integration/react’;

import {ActivityIndicator, View} from ‘react-native’

const config = {

key: ‘root’,

storage: AsyncStorage,

blacklist: [‘loading’],

debug: true, //to get useful logging


import { persistStore, persistReducer } from ‘redux-persist’;

const reducers = persistReducer(config, rootReducers);

const persistConfig: any = { };

export const store = configureStore({

reducer: reducers,


export const persistor = persistStore(store, persistConfig);

export default function index() {

return (

<Provider store={store}>

<PersistGate loading={<ActivityIndicator />} persistor={persistor}>

<View >






4.Now you can dispatch action and get value in your project ,
5. if you want to integrate middleware click here here for configure store from scratch using redux toolkit here for configure persist store using redux toolkit here for configure middleware using redux toolkit here for configure redux-logger using redux toolkit



Software Engineer (React/React Native Developer)

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahtisham Shahzad

Ahtisham Shahzad

Software Engineer (React/React Native Developer)