Normal Functional component
function HelloWorld(props) {
return <h1>Hello, {props.name}</h1>;
}
es6 Arrow function component
const HelloWorld = props => {
return <h1>Hello, {props.name}</h1>;
};
Class Component
class HelloWorld extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return <h1>Hello, {this.props.name}</h1>;
}
}
π‘ TLDR; For understanding
props
, we will be refering theReact Official Documentation
to get better understanding. Rendering a Component