How to render to the correct node?

Tell us what’s happening:
None of my tests are passing even though to the naked eye it seems to be doing what it should be I suspect my problem is this bit of code. document.getElementById('challenge-node') The directions didn’t say which node to use so I guessed and this one seemed to work (I also tried root but that overwrote the other outputs. ) How should I be rendering and to which node?

Your code so far


class ReturnTempPassword extends React.Component {
 constructor(props) {
   super(props);

 }
 render() {
   return (
       <div>
           { /* change code below this line */ }
           <p>Your temporary password is: 
           <strong> {this.props.tempPassword}</strong>
           </p>
           { /* change code above this line */ }
       </div>
   );
 }
};

class ResetPassword extends React.Component {
 constructor(props) {
   super(props);

 }
 render() {
   return (
       <div>
         <h2>Reset Password</h2>
         <h3>We've generated a new temporary password for you.</h3>
         <h3>Please reset this password from your account settings ASAP.</h3>
         { /* change code below this line */ }


 {
 ReactDOM.render(<ReturnTempPassword tempPassword='ch@ngeM3' />, document.getElementById('challenge-node') )
}
         { /* change code above this line */ }
       </div>
   );
 }
};

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 12607.58.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.86 Safari/537.36.

Challenge: Access Props Using this.props

Link to the challenge:
https://www.freecodecamp.org/learn/front-end-libraries/react/access-props-using-this.props

You don’t need ReactDOM.render() function to render a class inside another class.
simply call that class using <ReturnTempPassword tempPassword='ch@ngeM3' />

1 Like

Thank you, that was driving me crazy.