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

170
Views
How to use static information in react app?

I have a card designed in react. The card needs to appear throughout the project (on different pages).

Each card will have different titles, subtitles, and amount.

How can I go about doing this? I thought about creating an object and then looping through it. Calling the card component on different pages, but this won't allow me to change the content depending on the page.

Card.js

const cards = [
   {title: Card A, subtitle: Card A Subtitle},
   {title: Card A2, subtitle: Card A2 Subtitle},
   {title: Card A3, subtitle: Card A3 Subtitle},
]

{cards.map through cards to display it}

ExamplePageA.js. (Card:3, title: CardA, Subtitle:CardASubtitle....)

<Card />
<OtherStuff />

ExamplePageB.js (Card:2, title: cardB, Subtitle: CardBSubtitle....)

<Card />
<OtherStuffB />
<OtherStuffToo />
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You must pass props to your card component so that you can use it multiple times with different data:

export const Card = (props) => {
  return (
    <div>{props.title}<div/>
    <div>{props.subtitle}<div/>
  )
}

And then you should use it like this:

<Card title="Your title" subtitle="Your subtitle"/>

If you want to map through your cards array you should approach it like this inside of return in your parent component:

{cards.map((card) => <Card title={card.title} subtitle={card.subtitle}/>)}
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!