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
1class Welcome extends React.Component {
2 render() {
3 return <h1>Hello, {this.props.name}</h1>;
4 }
5}
1class Welcome extends React.Component {
2 render() {
3 return <h1>Bonjour, {this.props.name}</h1>;
4 }
5}
1class ComponentName extends React.Component {
2 render() {
3 return ;
4 }
5}
6
7export default ComponentName;
8
1// New component class starts here:
2class Friend extends React.Component {
3 render() {
4 const friend = friends[0];
5 return (
6 <div>
7 <h1>{friend.title}</h1>
8 <img src={friend.src}/>
9 </div>
10 );
11 }
12}
1class Car extends React.Component {
2 render() {
3 return <h2>Hi, I am a Car!</h2>;
4 }
5}
6