React: super(props)

“It uses super() to call the constructor of the parent class, in this case React.Component”

Is the constructor of the parent class React.Component, or is the parent class itself React.Component?

React.Component is the class. That class has a constructor to which super is pointing.

1 Like

So would the parent be Kitty?

Kitten is the class we are using. It extends the class React.Component so React.Component is the parent class. The class React.Component has a constructor. We need to call the constructor of the parent from the child (Kitten). From inside the constructor of Kitten we can access the constructor of React.Component as super.

1 Like

Very clear, thank you.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.