最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Found non-callable @@iterator in reactjs store - Stack Overflow

programmeradmin0浏览0评论

TypeError: Found non-callable @@iterator

const  middelware ={thunk};
 const Store = createStore(
      rootReducer,initialState, compose(
          applyMiddleware(...middelware),
           window.devToolsExtension ? window.devToolsExtension() : f=> f

const  middelware ={thunk};
 const Store = createStore(
      rootReducer,initialState, compose(
          applyMiddleware(...middelware),
           window.devToolsExtension ? window.devToolsExtension() : f=> f

TypeError: Found non-callable @@iterator

const  middelware ={thunk};
 const Store = createStore(
      rootReducer,initialState, compose(
          applyMiddleware(...middelware),
           window.devToolsExtension ? window.devToolsExtension() : f=> f

const  middelware ={thunk};
 const Store = createStore(
      rootReducer,initialState, compose(
          applyMiddleware(...middelware),
           window.devToolsExtension ? window.devToolsExtension() : f=> f
Share Improve this question edited Jan 15, 2020 at 16:55 Kevin Beal 10.8k13 gold badges70 silver badges93 bronze badges asked Oct 25, 2019 at 5:07 Hari MohanHari Mohan 1011 gold badge2 silver badges7 bronze badges 1
  • This has nothing to do with React or Redux. – Kevin Beal Commented Jan 15, 2020 at 16:56
Add a comment  | 

2 Answers 2

Reset to default 15

Presumably middleware is an object and not an array, so here or somewhere else, you are doing the equivalent of this:

applyMiddleware(...{})

rather than:

applyMiddleware(...[])

Spreading arguments in function calls can only be done with arrays or other similar iterable objects.

Enhancing Kevin Beal answer,

You can use:

applyMiddleware(...Object.values(middleware))
发布评论

评论列表(0)

  1. 暂无评论