Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

143
Visualizações
How do I render images on the webpage in react from an array?

The images are not showing on the webpage, and I have been unable to figure out the problem. here's my code. I had even tried using images locally on my computer, still the same.

import MeetupList from "../components/layout/meetups/meetupList";
    
const DATA = [
        {
          id: 'm1',
          title: 'This is a first meetup',
          image: 'https://unsplash.com/photos/nSY9XBCk58Y',
          address: 'Meetupstreet 5, 12345 Meetup City',
          description:
            'This is a first, amazing meetup which you definitely should not miss. It will be a lot of fun!',
        },
        {
          id: 'm2',
          title: 'This is a second meetup',
          image: 'https://unsplash.com/photos/nSY9XBCk58Y',
          address: 'Meetupstreet 5, 12345 Meetup City',
          description:
            'This is a first, amazing meetup which you definitely should not miss. It will be a lot of fun!',
        },
      ];


function AllMeetUpsPage(){
return <section>
    <h1>All Meetups</h1>
    <MeetupList meetups={DUMMY_DATA}/>
    
    </section> 
}

export default AllMeetUpsPage

#MeetupList component

import classes from './meetupList.module.css'

function MeetUpList(props){
return <ul className={classes.list}>
    {props.meetups.map(meetup =>
     <meetupItem key={meetup.id} id={meetup.id} 
    image={meetup.image}
    title={meetup.title} 
    address={meetup.address} 
    description={meetup.description} />)}
</ul>
}
 export default MeetUpList
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

export const TEST = () => {
  const ImageData = [
    {
      src: "img-path",
      alt: "this is x",
    },
    {
      src: "img-path",
      alt: "this is x",
    },
    {
      src: "img-path",
      alt: "this is x",
    },
    {
      src: "img-path",
      alt: "this is x",
    },
  ];
  return (
    <div>
      {ImageData.map((properties) => (
        <img {...properties} />
      ))}
    </div>
  );
};

This is one way. You probably can't do {...properties} when you include description etc.

about 4 years ago · Juan Pablo Isaza Relatório

0

const MeetupList=({meetups})=>{
   
    return(
        <>
   {
       meetups.map((item,index)=>{
        const[id,title,image,address,description]=item;
        <>
           <p>{id}</p>
           <p>{title}</p>
           //local image
           <img src={require("path")}/>
           //http images
           <img src={image}/>
           <p>{address}</p>
           <p>{description}</p>
           </>

       })
   }
        </>
    )
}

In order to load local images to your React.js application, you need to add require parameter in media sections.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda