如何解决?
composeWithDevTools(applyMiddleware()) // work
composeWithDevTools(applyMiddleware(thunk)) // don't work
控制台错误消息:
Uncaught TypeError: Cannot call a class as a function
代码:
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'react-thunk';
createStore(reducer, composeWithDevTools(applyMiddleware(thunk)));
最佳答案
相反
import thunk from 'react-thunk';
必须是
import thunk from 'redux-thunk';
关于javascript - 积分 'react-thunk' : 'cannot call a class as a function' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41119340/