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

94
Views
mapping from another component Reactjs

I have created an array data for (title,desc,images,etc...) from one component and want to mapping in another component:

    return (
        <div className={styles.container}>
          {data.map((pizza, i) => ( 
            <>
               <Image src={pizza.imgSrc} key={i} alt="" width="500" height="500" />
            <h1 className={styles.title}>{pizza.title}</h1>
            <span className={styles.price}>{pizza.price}</span>
            <p className={styles.desc}>
          {pizza.desc}
        </p>
        </>
          ))}
      </div>
    );

my container CSS:

.container {
    width: 22%;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

It is rendering only flex-direction: column, I want to render 'row' but nothing happen.

Can someone help me?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I think the width of the container is so small, It just 22% and your image has size 500x500. You can try width: 100% or width: 100vw

about 4 years ago · Juan Pablo Isaza Report

0

First I don't see flex-direction: row in .container. And I would recommend you to create a wrapper instead of empty tag, because your key={i} won't work on <Image /> (you can set you key only on top component)

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!