尚硅谷-react教程-求和案例-@redux-devtools/extension 开发者工具使用-笔记

cs 复制代码
## 7.求和案例_react-redux开发者工具的使用
    (1).npm install @redux-devtools/extension
    (2).store中进行配置
        import { composeWithDevTools } from '@redux-devtools/extension';
        export default createStore(allReducer,composeWithDevTools(applyMiddleware(thunk)))
  • src/redux/store.js
cs 复制代码
/*
*  该文件专门用于暴露一个store对象,整个应用只有一个store对象
* */

// store.js
//引入createStore,专门用于创建redux中最为核心的store对象
import {createStore,applyMiddleware,combineReducers} from 'redux'
//引入为Count组件服务的reducer
import countReducer from './reducers/count'
//引入为Person组件服务的reducer
import personReducer from './reducers/person'
//引入redux-thunk,用于支持异步action
import {thunk} from 'redux-thunk'
//引入redux-devtools-extension
import { composeWithDevTools } from '@redux-devtools/extension';

// 合并多个reducer
const allReducer = combineReducers({
    he:countReducer,
    rens:personReducer
})
//导出store
export default createStore(allReducer,composeWithDevTools(applyMiddleware(thunk)))

推荐和参考阅读文章:

安装和使用 Redux DevTools 插件-CSDN博客https://blog.csdn.net/huangjuan0229/article/details/136901744

相关推荐
im_AMBER1 天前
Leetcode 59 二分搜索
数据结构·笔记·学习·算法·leetcode
用户47949283569151 天前
React Grab 原理篇:它是怎么"偷窥" React 的?
人工智能·react.js·ai编程
q***38511 天前
TypeScript 与后端开发Node.js
javascript·typescript·node.js
Nan_Shu_6141 天前
学习:Sass
javascript·学习·es6
天殇凉1 天前
AC自动机学习笔记
java·笔记·学习
AA陈超1 天前
从0开始学习 **Lyra Starter Game** 项目
c++·笔记·学习·游戏·ue5·lyra
WYiQIU1 天前
面了一次字节前端岗,我才知道何为“造火箭”的极致!
前端·javascript·vue.js·react.js·面试
qq_316837751 天前
uniapp 观察列表每个元素的曝光时间
前端·javascript·uni-app
小夏同学呀1 天前
在 Vue 2 中实现 “点击下载条码 → 打开新窗口预览 → 自动唤起浏览器打印” 的功能
前端·javascript·vue.js
芳草萋萋鹦鹉洲哦1 天前
【vue】导航栏变动后刷新router的几种方法
前端·javascript·vue.js