React

ReactJS Practical Questions - Find the bug in this...

22.

Find the bug in this React code:

import React from 'react';

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      name: 'John',
      age: 25,
      gender: 'male'
    };
  }

  render() {
    return (
      <div>
        <h1>Hello, {this.state.name}!</h1>
        <p>You are {this.age}</p>
        <p>Your gender is {this.state.gender}</p>
      <div>
    );
  }
}

export default App;

The variable this.age should be this.state.age.

The gender key should be in quotes ('gender').

Missing closing tag for the div.

Missing render() method inside the class.