Tell us what’s happening:
Your code so far
class Results extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<h1>
{this.props.fiftyFifty}
</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() >= .5; // change code here
return (
<div>
<button onClick={this.handleClick}>Play Again</button>
{ /* change code below this line */ }
{(expression)? <Results fiftyFifty = "You Win!" /> : <Results fiftyFifty = "You Lose!" />}
{ /* 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_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15
.
Challenge: Render Conditionally from Props
Link to the challenge:
https://www.freecodecamp.org/learn/front-end-libraries/react/render-conditionally-from-props
The same problem happened to me yesterday that it all lookes fine in the console, but can’t pass the last requirement. Wondering if there is something I didn’t see here in my code or just the same issue with my browser?
I tried to refresh the page but still doesn’t work.