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

153
Views
How does React know this.props?

When I watch tutorials they try to read this.props without defining the term props anywhere. Is props a keyword? If not how does React know that it is props without defining it anywhere in the code?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No, props isn't a keyword. The React.Component constructor receives the props object (because React.createElement passes them to the component function as the first argument; JSX generates the calls to React.createElement) and assigns props to the instance being created, like this:

constructor(props) {
//          ^^^^^−−−−−−−−−−− parameter
    this.props = props;
//  ^^^^^^^^^^^^^^^^^^−−−−−− assignment
    // ...
}

That's why if you create your own constructor, you have to pass the object you receive as the first parameter to super like this:

class MyComponent extends React.Component {
    constructor(props) {
       super(props);
//           ^^^^^^−−−−−−−−− passing them on to `super`
        // ...
    }
}
about 4 years ago · Juan Pablo Isaza 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!