Class Component in react
Class components are ES6 classes that extend React.Component. They were the primary way to manage state and lifecycle before Hooks (React 16.8). They use the 'render' method to return JSX and 'this.state' for data. While functional components are now preferred, understanding classes is vital for legacy codebases and specific features like Error Boundaries.
Example
class Welcome extends React.Component {
render() {
return <h1>Hello, {this.props.name}</h1>;
}
}