【问题标题】:TypeError: dispatch is not a function at indexAction.js:66 at wrap (spread.js:25)TypeError: dispatch is not a function at indexAction.js:66 at wrap (spread.js:25)
【发布时间】:2018-04-24 04:05:16
【问题描述】:

Here is my code

我应该怎么做才能解决这个问题?

【问题讨论】:

  • 请在问题中添加您的代码,以便更轻松地为您提供帮助。您链接的页面加载速度很慢。

标签: redux react-redux


【解决方案1】:

您需要设置redux-thunk 以异步调度操作。有关更多信息,请转到 hereredux-thunk 文档。

...
import thunk from 'redux-thunk';
...

const store = createStore(novelReducer, undefined, compose(
    applyMiddleware(thunk, routerMiddleware(history)),
    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
))
...

【讨论】:

  • 在我们这样的 redux-thunk 之后 ` const history = createHistory(); // const store = createStore( // novelReducer, // applyMiddleware(thunk) // ); const store = createStore( NovelReducer, undefined, compose( applyMiddleware(thunk, routerMiddleware(history)), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() ) ); ` 问题也存在
猜你喜欢
  • 2020-06-29
  • 2019-02-13
  • 2021-08-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-02
  • 2019-09-02
  • 1970-01-01
相关资源
最近更新 更多