我自己无法发现代码中的任何缺陷,我遇到了错误


  未捕获的TypeError:(0,_reactRedux.applyMiddleware)不是
  功能


import { applyMiddleware, createStore } from 'react-redux'
import { promiseMiddleware } from './middleware'

const defaultState = {
    appName: 'conduit',
}

const reducer = (state = defaultState, action) => {
    switch(action.type) {
        case 'HOME_PAGE_LOADED':
            return { ...state, articles: action.payload.articles }
    }
    return state
}

const middleware = applyMiddleware(promiseMiddleware)

const store = createStore(reducer, middleware)

export default store


有什么线索吗?

最佳答案

您的进口商品混杂了。 createStoreapplyMiddleware是Redux主软件包的一部分,而不是React-Redux。你需要:

import {createStore, applyMiddleware} from "redux";

09-05 22:11