Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!