Question: Which class-based component is equivalent to this function component?

  1. `class Greeting extends React.Component { render() { return

    Hello {this.props.name}!

    ; } }`
  2. `class Greeting extends React.Component { constructor() { return

    Hello {this.props.name}!

    ; } }`
  3. `class Greeting extends React.Component { Hello {this.props.name}!; } }`
  4. `class Greeting extends React.Component { render({ name }) { return

    Hello {name}!

    ; } }`

Answer: The correct answer of the above question is Option A:`class Greeting extends React.Component { render() { return

Hello {this.props.name}!

; } }`