what is react component? code example
Example 1: react component
/* React Component Template */
export default class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
//state properties here
};
}
render() {
return (
<div></div>
);
}
}
Example 2: React Components
class Car extends React.Component {
render() {
return <h2>Hi, I am a Car!</h2>;
}
}