1class MyComponent extends React.Component{
2 constructor(props){
3 super(props);
4 };
5 render(){
6 return(
7 <div>
8 <h1>
9 My First React Component!
10 </h1>
11 </div>
12 );
13 }
14};
15
1/* React Component Template */
2export default class MyComponent extends React.Component {
3 constructor(props) {
4 super(props);
5 this.state = {
6 //state properties here
7 };
8 }
9 render() {
10 return (
11 <div></div>
12 );
13 }
14}
1class Welcome extends React.Component {
2 render() {
3 return <h1>Hello, {this.props.name}</h1>;
4 }
5}
1class Car extends React.Component {
2 render() {
3 return <h2>Hi, I am a Car!</h2>;
4 }
5}