Objects are not valid as a React child
来源:4-11 react-router4 路由 04-和 Redux 配合-复杂 Redux 应用2

慕少5155609
2017-11-26
当我吧index.js里的counter换成reducers的时候就报这个错误
Objects are not valid as a React child (found: object with keys {counter, auth}). If you meant to render a collection of children, use an array instead.
已经卡了1个小时了求解。。
写回答
3回答
-
慕少5155609
提问者
2017-11-26
已经解决了,因为reducer合并后state变成了一个对象所以App.js里state的值也要变
332019-04-20 -
jiuchang
2018-10-26
上面同学的回答好像不大对,@connect(state=>({num:state.num}), { addGUN, removeGUN, addGUNAsync})的state.num应该改成state.counter才对,因为这个时候state里面没有num了。如果按照原来的改,num将会是无值
20 -
陌上蓝枫梦
2018-05-04
我卡了一个小时,刚找出答案,才发现你这儿有,瞬间mmp,以后要多看问答区...
10
Redux+React Router+Node.js全栈开发
全网唯一的React 16+Redux+React Router4实战课程,学到手是你的真本领!
1822 学习 · 750 问题
相似问题