Render Conditionally from Props-error debugging

Render Conditionally from Props-error debugging
0

#1

Tell us what’s happening:

Can’t figure out the mistake in this.
Thank you!

Your code so far


class Results extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <h1>
      {
        /* change code here */
        this.props.fiftyFifty > 0.5? <p>You Win</p>: <p>You loose</p>
      }
      </h1>
    )
  };
};

class GameOfChance extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      counter: 1
    }
    this.handleClick = this.handleClick.bind(this);
  }
  handleClick() {
    this.setState(
      { counter: 1 + this.state.counter }
      );
  }
  render() {
    let expression = Math.random() > .5; // change code here
    return (
      <div>
        <button onClick={this.handleClick}>Play Again</button>
        { /* change code below this line */ }
         <Results fiftyFifty = expression />
        { /* change code above this line */ }
        <p>{'Turn: ' + this.state.counter}</p>
      </div>
    );
  }
};

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/render-conditionally-from-props/


#2
<Results fiftyFifty = expression />

You have a syntax error here.

Also, pay very close attention to your spelling, punctuation, and capitalization. Hint: “loose” !== “lose”.

Lastly, <Results /> doesn’t need to render any <p> elements.


#3

Thank You!
Was able to solve it!