react creating components code example
Example 1: how to create component in reactjs
class Car extends React.Component {
render() {
return <h2>Hi, I am a Car!</h2>;
}
}
Example 2: create-react-app class component
npx create-react-app my-app --scripts-version react-scripts@2.1.7