class Parent extends React.Component{ constructor(props) { super(props); this.state = { test: "" }; } render() { return ( <Child /> ); } } class Child extends React.Component{ constructor(props) { super(props); } func() { //ここで親のstateのtestの値をいじりたい } render() { return ( <div onClick={this.func}>btn</div> ); } }
上記のような構造で、
子のイベントで親のstateの値を変更したいのですが
可能でしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/09 03:50
2018/02/09 04:17
2018/02/09 04:23