Skip to content

Instantly share code, notes, and snippets.

@vish448
Last active March 19, 2019 00:59
Show Gist options
  • Save vish448/1de2fab4d9039752b5bc0788245f70cd to your computer and use it in GitHub Desktop.
Save vish448/1de2fab4d9039752b5bc0788245f70cd to your computer and use it in GitHub Desktop.
How to pass props to one class components to another
//Parent component
class Parent extends React.Component {
render() {
return (
<Child example="foo" />
)
}
}
//Child Component
class Child extends React.component {
render() {
return (
<h1>{this.props.example}</h1>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment