There are two possible ways to create a component.
1. Function Components: This is the simplest way to create a component. Those are pure JavaScript functions that accept props object as first parameter and return React elements:
2. function Greeting({ message }) {
3. return
{`Hello, ${message}`}
}
4. Class Components: You can also use ES6 class to define a component. The above function component can be written as:
5. class Greeting extends React.Component {
6. render() {
7. return
{`Hello, ${this.props.message}`}
8. }