why to use class components react code example
Example 1: react class component
class Welcome extends React.Component {
render() {
return <h1>Bonjour, {this.props.name}</h1>;
}
}
Example 2: class component in react
class Car extends React.Component {
render() {
return <h2>Hi, I am a Car!</h2>;
}
}