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

330
Vistas
How can I fix eslint: react/destructuring-assignment error?

const Container = (props) => {
    return (
        <StyledDiv>
            <SmallScreenDiv>{props.children}</SmallScreenDiv>
        </StyledDiv>
    );
};

This is my code and error happens at {props.children}
how can I fix this eslint error?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can also destruct your props like this:

const Container = ({children}) => {
    return (
        <StyledDiv>
            <SmallScreenDiv>{children}</SmallScreenDiv>
        </StyledDiv>
    );
};
about 4 years ago · Juan Pablo Isaza Denunciar

0

There are two solution for this

  1. Disable the prefer-destructuring feature on the eslint

  2. destructure your props

     const Container = ({children}) => {
     return (
         <StyledDiv>
             <SmallScreenDiv>{children}</SmallScreenDiv>
         </StyledDiv>
     );
     };
    

or

   const Container = (props) => {
    const {children} = props
    return (
        <StyledDiv>
            <SmallScreenDiv>{children}</SmallScreenDiv>
        </StyledDiv>
    );
    };

I will recommend to use second option.

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