How to update parent's state in React?

后端 未结 14 1630
粉色の甜心
粉色の甜心 2020-11-22 08:48

My structure looks as follows:

Component 1  

 - |- Component 2


 - - |- Component 4


 - - -  |- Component 5  

Component 3

Component 3 s

14条回答
  •  不要未来只要你来
    2020-11-22 09:33

    this.setState({showChart: true})} />
    {console.log(this.props)}
    Try this example to write inline setState, it avoids creating another function.

提交回复
热议问题