Created
August 3, 2016 13:57
-
-
Save jshawl/21eb8bec93449de08ed8ecf77df93ef7 to your computer and use it in GitHub Desktop.
This file contains 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
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