What is super( )? React

Please explain in detail what is super does?
Sorry for screenshot.

In other programming lanugae such as java and c++. Super() is referring to the parent. In the case of constructor, it is calling the parent constructor.

It’s not React, it’s ES6.

You can find most of the information you need in docs.

1 Like

Hi @SerafimPoch

If you’ve seen the ES5 way of creating a ‘class’, super is essentially syntactic sugar for:

function Child(props) {
  Parent.call(this, props); // This is what super() does basically.
}
2 Likes