Objects are not valid as a React child 老师报这个错误怎么解决

来源:4-8 react-router4 路由 01-初识 React-router4

慕粉0019008925

2017-12-17

写回答

2回答

trinidy

2018-01-24

@蜗牛老湿  我也是这个问题,我打印了一下app.js里的this.props

//img.mukewang.com/szimg/5a684a440001f32e10420451.jpg

所以是改成props.counter或者props.num.counter都对的,我想问我这个是哪里出问题了呢?

0
0

慕瓜8449030

2017-12-17

你好,这个是你用了 combineReducers 后,你的用的 counter的 state 不是一个数字了,而是一个对象,你用到的地方原来是 props.num改成 props.counter.num

0
0

Redux+React Router+Node.js全栈开发

全网唯一的React 16+Redux+React Router4实战课程,学到手是你的真本领!

1822 学习 · 750 问题

查看课程