Render Conditionally from Props DOM Issue

Tell us what’s happening:

Unsure as to why this won’t pass when the behaviour of the game seems correct. A little bit of insight would be appreciated. Thanks!

Your code so far


class Results extends React.Component {
constructor(props) {
  super(props);
}
render() {
  return (
    <h1>
    {

      /* change code here */

        this.props.fiftyFifty ? "You Win!" : "You Lose!"
    }
    </h1>
  )
};
};

class GameOfChance extends React.Component {
constructor(props) {
  super(props);
  this.state = {
    counter: 1
  }
  this.handleClick = this.handleClick.bind(this);
}
handleClick() {
  this.setState({
    counter: this.state.counter + 1 // change code here
  });
}
render() {
const expression = Math.random() >= 0.5 ? true : false // 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_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15.

Challenge: Render Conditionally from Props

Link to the challenge:

idk why but I copypaste it and it’s passed

2 Likes

Hey @markbrathwaite,

  • As @Dorfieeee said, Your code works fine. It seems like the problem might be your browser’s extensions that have access to the FCC site. Try disabling some extensions. If the problem still persists, try a different browser, because it seems like you are using Safari 13 on macOS (Catalina). Try Chrome, It’s by far the official supported browser for FCC Curicullum.
1 Like

Thanks for the advice. I need to start using Chrome or Firefox more often for most things. There’s too many issues with Safari these days.

1 Like