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

73
Vistas
.map Issue not showing props
export const products = [
  {
    id: 1,
    title: "Chocotorta",
    desciption: "Torta de chocolate y dulce de leche",
    price: "$2,40",
    imgDesc: "",
    imgUrl: ""
  }
];

const Item = (prod) => {
  return (
    <>
      <Card key={prod.id}>
        <CardImg alt={prod.imgDesc} src={prod.imgUrl} top width="100%" />
        <CardBody>
          <CardTitle tag="h5">{prod.title}</CardTitle>
          <CardSubtitle className="mb-2 text-muted" tag="h6">
            {prod.price}
          </CardSubtitle>
          <CardText>{prod.desciption}</CardText>
          <Button>Mostrar detalle</Button>
        </CardBody>
      </Card>
    </>
  );
};

return (
  <>
    {loading ? (
      <div style={spinnerStyle}>
        <Spinner color="primary" size="">
          .
        </Spinner>
      </div>
    ) : (
      products.map((prod) => <Item prod={products} />)
    )}
  </>
);
about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

I would rename the map element to itemProd or something, prod is used a lot in this snippet. That being said, you aren't passing anything into the <Item />, your snippet should be something like:

products.map((itemProd) => <Item prod={itemProd} />)

Edit: actually it looks like you also need to do this as well:

const Item = ({prod}) => {...}
about 4 years ago · Juan Pablo Isaza Denunciar

0

Hi I guess this is what you are looking for

export const products = [
      {
        id: 1,
        title: "Chocotorta",
        desciption: "Torta de chocolate y dulce de leche",
        price: "$2,40",
        imgDesc: "",
        imgUrl: ""
      }
    ];
    
    const Item = ({prod}) => {
      return (
        <>
          <Card>
            <CardImg alt={prod.imgDesc} src={prod.imgUrl} top width="100%" />
            <CardBody>
              <CardTitle tag="h5">{prod.title}</CardTitle>
              <CardSubtitle className="mb-2 text-muted" tag="h6">
                {prod.price}
              </CardSubtitle>
              <CardText>{prod.desciption}</CardText>
              <Button>Mostrar detalle</Button>
            </CardBody>
          </Card>
        </>
      );
    };
    
    return (
      <>
        {loading ? (
          <div style={spinnerStyle}>
            <Spinner color="primary" size="">
              .
            </Spinner>
          </div>
        ) : (
          products.map((product) => <Item prod={product} key={product.id} />)
        )}
      </>
    );
about 4 years ago · Juan Pablo Isaza Denunciar

0

 const items =
    products.map((item) => {
        return (<Item prod={item} key={item.id} />)
    })
;

And put the variable in your return like this:

 {items}
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