← React Beginner Questions - Set 12 Q111

What is the difference between class components and functional components?

React Beginner Questions - Set 12

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