Tell us what’s happening:
How do we know MyApp is a parent component and Navbar is a child component or how do we set them as parent and child? Passed the test just trying to comprehend DOM better.
Your code so far
class MyApp extends React.Component {
constructor(props) {
super(props);
this.state = {
name: 'CamperBot'
}
}
render() {
return (
<div>
{/* Change code below this line */}
<Navbar name={this.state.name} />
{/* Change code above this line */}
</div>
);
}
};
class Navbar extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
{/* Change code below this line */}
<h1>Hello, my name is: {this.props.name}</h1>
{/* Change code above this line */}
</div>
);
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
.
Challenge: Pass State as Props to Child Components
Link to the challenge: