Suppose a component -
class MyComponent extends React.Component {
render() {
return <h1>Hi, {this.props.name}</h1>
}
}
And the instance of MyComponent -
class Parent extends React.Component {
render() {
return <MyComponent name = 'Jack' />
}
}
How can we even define props without defining it in the constructor of MyComponent like -
constructor(props) {
super(props);
}