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

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

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 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