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

171
Vistas
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 Respuestas
Responde la pregunta

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 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