react component in 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>;
}
}
Example 3: react.component
class Welcome extends React.Component {
render() {
return <h1>Hello, {this.props.name}</h1>;
}
}