Last active
August 14, 2018 13:41
-
-
Save maecapozzi/3a172f1935132eca23dd0700735717e1 to your computer and use it in GitHub Desktop.
Prop Drilling
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
const App = () => <Grandmother /> | |
class Grandmother extends React.Component { | |
state = { | |
lastName: "Sanchez" | |
} | |
render() { | |
return <Mother lastName={this.state.lastName} /> | |
} | |
} | |
const Mother = ({ lastName }) => { | |
return <Child lastName={lastName} /> | |
} | |
const Child = ({ lastName }) => { | |
return <p>{lastName}</p> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment