1//ChildExt component
2class ChildExt extends React.Component {
3 render() {
4 return (<div><button onClick={() => this.props.handleForUpdate('someNewVar')}>Push me</button></div>
5 )}
6}
7//Parent component
8class ParentExt extends React.Component {
9 constructor(props){
10 super(props);
11 this.state = {lol: false }
12 }
13
14 handleForUpdate(someArg){
15 this.setState({lol: true});
16 console.log(someArg);
17 }
18 //Notice how we don't pass the arguments into the bind.this even though it does take an argument.
19 render() {
20 return (<ChildExt handleForUpdate={this.handleForUpdate.bind(this)} />)
21 }
22}