React 持久化全局数据状态管理(redux-toolkit、react-redux、redux-persist)

一、创建 store 仓库(数据持久化)

store 入口文件(redux/index.js)

// 导入各个模块的 reducer
import global from './modules/global';
import auth from './modules/auth';

import reduxThunk from "redux-thunk";
import reduxPromise from "redux-promise";

import {
    configureStore, combineReducers } from "@reduxjs/toolkit";

const reducer = combineReducers({
   
    global,
    auth
});

// 持久化 reducer 配置
const persistConfig = {
   
    key: 

你可能感兴趣的:(React,react.js,redux-toolkit,react-redux,redux-persist)