React - Render Conditionally from Props

Tell us what’s happening:
Describe your issue in detail here.
I did everything correctly but the console says Build error. This error appears when I compose the Results component in the Game0fChance component. Help me
Your code so far

class Results extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    {/* Change code below this line */}
    <h1>
    {this.props.fiftyFifty ? "You Win!": "You Lose!"}
    </h1>
    {/* Change code above this line */}
  }
}

class GameOfChance extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      counter: 1
    };
    this.handleClick = this.handleClick.bind(this);
  }
handleClick() {
  this.setState(prevState => {
    // Complete the return statement:
    return {
      counter: prevState.counter + 1 
    }
  });
}
  render() {
    const expression = Math.random() >= .5 ? true:false // Change this line
    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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Challenge: React - Render Conditionally from Props

Link to the challenge:

welcome to our community! :balloon: :tada:
well,you need to return the h1 tag in the render method of the Results component,with out returning it,it would not be displayed in the output.
so,use return keyword in front of the h1 tag.

Just an FYI, you can click the error link in the browser console and it will take you to this page.

Results(…): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.