React: Render Conditionally from Props, solved but want to understand what's happening

I understand how everything works except for the const expression. when I click the button expression generates a new value. but I don’t understand why. the handleClick method only changes the counter state. nothing generates a new value for expression so why does it change every time I click the button?

Your code so far


class Results extends React.Component {
constructor(props) {
  super(props);
}
render() {
  return (
    <h1>
    {
      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() > .5 ? true : false;
  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_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15.

Challenge: Render Conditionally from Props

Link to the challenge:

Hey @sincerelyjames !

When you click on the button ->HandleClick method executes ->state of the counter is updated -> Whenever a state update happens ,React executes the render method ->which set the random value to the expression ,everytime you click the buttton.Hope this helps.