Skip to content

Instantly share code, notes, and snippets.

@aykutyaman
Created September 23, 2016 12:18
Show Gist options
  • Save aykutyaman/8c6d9c5779ededef1dc5775a8c171df3 to your computer and use it in GitHub Desktop.
Save aykutyaman/8c6d9c5779ededef1dc5775a8c171df3 to your computer and use it in GitHub Desktop.
class Child extends React.Component {
greeting() {
return 'hello world';
}
}
class Parent extends React.Component {
render() {
return (
<TheChild ref='foo' />
)
}
componentDidMount() {
const bar = this.refs.foo.greeting();
// bar is now 'hello world'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment