Created
November 4, 2016 15:32
-
-
Save hai5nguy/b39564e97f458e1d2489a20901f38421 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//parent.js | |
export default class Parent extends React.Component { | |
childClicked = (data) => { | |
console.log('data from child:', data) | |
} | |
render() { | |
return <Child onClick={this.childClicked} } /> | |
} | |
} | |
//child.js | |
export default class Child extends React.Component { | |
clicked = (e) => { | |
var data = 'some data' | |
this.props.handleClick(data) | |
} | |
render() { | |
return <div onClick={this.prop.handleClick}>I am child</div> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment