← React Intermediate Questions - Set 5 Q50

What are the differences between functional and class components in React?

React Intermediate Questions - Set 5

Example

function A() { const [n] = useState(0); return <p>{n}</p>; }
class B extends Component { state = { n: 0 }; render() { return <p>{this.state.n}</p>; } }

What to notice

← Back to the question list