What is the difference between super() and super(props) in React using ES6 classes?

Posted by Prem Tiwari | Updated on

What is the difference between super() and super(props) in React using ES6 classes?

When you want to access this.props in constructor() then you should pass props to super() method.

Using super(props):

Using super():

Outside constructor() both will display same value for this.props.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers