Skip to content

Instantly share code, notes, and snippets.

@maecapozzi
Last active August 14, 2018 13:41
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 maecapozzi/3a172f1935132eca23dd0700735717e1 to your computer and use it in GitHub Desktop.
Save maecapozzi/3a172f1935132eca23dd0700735717e1 to your computer and use it in GitHub Desktop.
Prop Drilling
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