react-study 使用react-devTools谷歌插件和Redux-thunk引入

react-devTools插件自行下载后拖拽到chrome中
redux-thunk安装:npm add redux-thunk
安装完thunk后准备使用,当引入redux-thunk提示
**

TypeError: middleware is not a function

**
index.js文件下

import { createStore, compose, applyMiddleware } from 'redux'
// 创建store 传入reducer
import reducer from './reducer'
// 引入thunk
import thunk from 'redux-thunk'

// 使用chrome redux开发者工具需要
const composeEnhancers = 
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose

//由于 applyMiddleware(...middleware)
const enhancer = composeEnhancers(
    applyMiddleware(thunk)
)

const store = createStore(
    reducer,
    enhancer
)

export default store

react-devTools插件成功后:F12中有Redux
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值