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

168
Vistas
How to print the props value in console.log?

I am new to react I was working on simple project as my code is below I just noticed how to print the value of listItem={people} as it is passed as props in my list component i.e <List listItem={people} so I can understand it in better way that what I am getting in listItem here, I tried {console.log(listItem)} but it says undefined

    *react*
   function App() {
  const [people, setPeople] = useState(data);


  return (
    <div className="container">
      <h3>{people.length} birthdays today</h3>
      <List listItem={people} />
      
      <button onClick={() => setPeople([])}>Clear All</button>

    </div>
  );
}

export default App;
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

All the parameters that you add to a component, in the component function will be sent as an object which has as key the parameter name you choose and the value that you set to it.

In the case below, I am destructuring the object that the List Component gets as a parameter.

function List({ listItem }) {
  console.log(listItem)
  
  return <div>List Component</div>
}

Here you can find more about destructuring.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You need to retrieve the prop first, this can be done with the following code.

console.log(props.listItem)

Please refer to the React Docs

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