how to create component in reactjs

JavaScript
class Car extends React.Component {
  render() {
    return <h2>Hi, I am a Car!</h2>;
  }
}const element = <div />;class MyComponent extends React.Component{
    constructor(props){
        super(props);
    };
    render(){
        return(
            <div>
              <h1>
              	My First React Component!
              </h1>
            </div>
        );
    }
};

Source

Also in JavaScript: