Lesson showing browser error. Kindly check

Some issue with Free code camp lesson of React: React: Use a Ternary Expression for Conditional Rendering

Hey @ss_chhaunkar!
Welcome to the Forum!

Can you please give a screenshot of the error?

Please try doing this

  • Restarting the browser
  • Try Disabling the extensions

Hi and welcome to the forum.

Without any information, we cannot provide any help beyond the default troubleshooting advice

  • clear your cache
  • restart your browser
  • update your browser
  • restart your computer
  • try incognito mode
1 Like

const inputStyle = {
  width: 235,
  margin: 5
};

class CheckUserAge extends React.Component {
  constructor(props) {
    super(props);
    // Change code below this line
this.state({
  input:'',
  userAge:''
})
    // Change code above this line
    this.submit = this.submit.bind(this);
    this.handleChange = this.handleChange.bind(this);
  }
  handleChange(e) {
    this.setState({
      input: e.target.value,
      userAge: ''
    });
  }
  submit() {
    this.setState(state => ({
      userAge: state.input
    }));
  }
  render() {
    const buttonOne = <button onClick={this.submit}>Submit</button>;
    const buttonTwo = <button>You May Enter</button>;
    const buttonThree = <button>You Shall Not Pass</button>;
    return (
      <div>
        <h3>Enter Your Age to Continue</h3>
        <input
          style={inputStyle}
          type='number'
          value={this.state.input}
          onChange={this.handleChange}
        />
        <br />
        {/* Change code below this line */}
{buttonOne}
{this.state.input<18 && {buttonThree}}
{this.state.input>=18 && {buttonTwo}}
        {/* Change code above this line */}
      </div>
    );
  }
}

issue resolved thanks to you all