Objects are not valid as a React child

前端 未结 3 600
轻奢々
轻奢々 2020-12-03 02:26

I am getting an below error. I can see that I have to return array instead of object. But I am really not sure how to fix it. Thanks in advance

Object

3条回答
  •  执笔经年
    2020-12-03 02:50

    • Short & simple is that use JSON.stringify()
    • because this.state.timeElapsed is the object. object not able to print in normal standered. Thus we need to render that object in JSON.stringify(). It converted into JSON form.

    • Try this, It's work for me

    {JSON.stringify(this.state.timeElapsed)}
    

提交回复
热议问题