Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
What is super(props) doing for my React component?

I am not great with JS and playing around with React.

The React docs located here state the following:

When implementing the constructor for a React.Component subclass, you should call super(props) before any other statement. Otherwise, this.props will be undefined in the constructor, which can lead to bugs.

My question is HOW does this actually work? What is super() doing that magically enables this.props within my constructor?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In the documentation that you have mentioned. It is coded in ES6 standard of javascript.

So this statement

class Greeting extends React.Component

It means Greeting is inherting from React.Component, by calling super, you are actually calling the parent element with props parameter,

if you intend on using this.props inside the constructor, you have to call super(props)

Hope these links are helpful.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!