state.set is not a function

来源:8-7 异步操作代码拆分优化

该比率

2019-08-07

Unhandled Rejection (TypeError):

state.set is not a function

push…/src/pages/chart/store/reducer.js.webpack_exports.default
C:/Users/41797/Desktop/react/numbers/src/pages/chart/store/reducer.js:16
13 | switch (action.type) {
14 | case constants.GET_CITY_DATA :
15 | console.log(action);

16 | return state.set(‘citySeries’, action.citySeries);
| ^ 17 | default:
18 | return state;
19 | }
View compiled
▶ 7 stack frames were collapsed.
axios__WEBPACK_IMPORTED_MODULE_0___default.a.get.then.res
C:/Users/41797/Desktop/react/numbers/src/pages/chart/store/actionCreators.js:15
12 | return (dispatch) => {
13 | axios.get(‘http://192.168.252.64/monitor/PriceAndProfitByCity’).then((res) => {
14 | const result = res.data;
15 | console.log( dispatch(getCityData(result)))
| ^ 16 | dispatch(getCityData(result))
17 | })
18 | }
View compiled
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.

写回答

1回答

Dell

2019-08-09

数据类型你看下是不是没有存成immutable的

0
0

React零基础入门到实战,完成企业级项目简书网站开发

主流新技术 React-redux,React-router4,贯穿基础语法

5275 学习 · 2496 问题

查看课程