Mid From PDF React React.js

Explain the difference between Class and Functional components.

Feature Class

Component

Functional

Component

Syntax ES6 Class Function

State this.state useState hook

Lifecycle methods Yes Use useEffect, etc.

Code size More verbose Cleaner and shorter

✅ Example:

Class:
class Welcome extends React.Component {

render() {

return <h1>Hello, {this.props.name}</h1>;
}
}

Functional:

function Welcome(props) {

return <h1>Hello, {props.name}</h1>;
}

More from React.js Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details