Question: Which class-based component is equivalent to this function component?
- `class Greeting extends React.Component { render() { return
Hello {this.props.name}!
; } }` - `class Greeting extends React.Component { constructor() { return
Hello {this.props.name}!
; } }` - `class Greeting extends React.Component {
Hello {this.props.name}! ; } }` - `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}!
; } }`