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