• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

158
Vistas
this map would not have to revolve 2 hello?

I'm practicing the map function and I don't understand why it doesn't return 2 hellos, what am I doing wrong?

I have no answer, what can I be doing wrong?

const Books = [
  {
    img: imagen,
    title: "murakami",
    año: 2022,
    genero: "terror",
    edicion: "ivrea",
  },
  {
    img: imagen2,
    title: "Joe hill",
    año: 2022,
    genero: "aventura",
    edicion: "panini",
  },
];

function BookList() {
  return (
    <section>
      {Books.map((book) => {
        return "Hello";
      })}
    </section>
  );
}

function App() {
  return <div>{BookList}</div>;
}

about 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

BookList is a component, but you are treating it as a react node. This works fine for types that can be react nodes: strings, numbers, or other Components work fine:

function App() {
  const content = "hello hello";
  return <div>{content}</div>;
}

What you are actually doing is trying to make an uncalled function a child of a react component. This is incorrect and should result in a runtime error.

return <div><BookList /></div> should do the trick, the JSX calls your component function, which should display it.

about 3 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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda