how is a component created in react code example
Example 1: class app extends component syntax
class Welcome extends React.Component {
render() {
return <h1>Hello, {this.props.name}</h1>;
}
}
Example 2: how to create component in reactjs
class Car extends React.Component {
render() {
return <h2>Hi, I am a Car!</h2>;
}
}