Access Props Using this.props getting errors

So here’s my code, i’m not too sure whats going on here. When i run the tests, I’m only getting the top one. Im lost here here tbh, I’ve followed along what other folks have put in this forum, and whats in the hints, and it makes sense, and i’m still not passing Im sure it’s something really really simple, but could use some fresh eyes on this. Thanks!

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 */ }
          <return ReturnTempPassword TempPassword = "Password1" />
          { /* change code above this line */ }
        </div>
    );
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36.

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

Okay here we go again.

The lesson requires you to spell the prop as tempPassword and not TempPassword. In JavaScript and React the text format camelCase is mostly used.

Also when using a component inside another component you need to use the syntax <Component propName={prop} />. You need to remove the return keyword as that isn’t needed. :smile:

When you want to pass props in React you need to use the syntax propName={prop}.

1 Like

lol yeah so i noticed the extra return. :rofl: whoops. Thats all it took after I fixed the tempPassword. Thanks!!

1 Like