Skip to content

Instantly share code, notes, and snippets.

@jshawl
Created August 3, 2016 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jshawl/21eb8bec93449de08ed8ecf77df93ef7 to your computer and use it in GitHub Desktop.
Save jshawl/21eb8bec93449de08ed8ecf77df93ef7 to your computer and use it in GitHub Desktop.
import React from 'react'
import ReactDOM from 'react-dom'
class GrandParent extends React.Component {
listen(sound){
console.log(sound)
}
render(){
return <div>
<Parent listen={sound => this.listen(sound) }/>
</div>
}
}
class Parent extends React.Component {
render(){
return <div>
<Child hear={ sound => this.props.listen(sound) }/>
</div>
}
}
class Child extends React.Component {
render(){
this.props.hear("meow")
return <div></div>
}
}
ReactDOM.render(
<GrandParent />,
document.getElementById('root')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment