React "Pass State as Props to Child Components"

Tell us what’s happening:
Having trouble with this challenge. Do not know how to do it.
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: <name/></h1>
    {/* Change code above this line */}
  </div>
  );
}
};
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15.

Challenge: Pass State as Props to Child Components

Link to the challenge:

Found the solution: Pass State as Props to Child Components-

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.