Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

155
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda