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

204
Views
¿Cómo agregar texto diferente después de que la función de mapa se haya renderizado 3 veces?

Quiero agregar algo de texto después de que las tarjetas se hayan renderizado tres veces. estas tarjetas toman valor de un archivo json local usando split y map. También quiero cambiar el texto cada tres veces que se haya renderizado el componente.

 import React from 'react'; import data from '../data.json'; import { Card,Button } from 'react-bootstrap'; function Med() { return ( <div> {data.slice(0,6).map((item)=>{ return ( <div> <Card style={{ width: '18rem' }}> <Card.Body> <Card.Title>{item.Name}</Card.Title> <Card.Text> This is the explaination of product card. </Card.Text> <Button variant="primary">Add to cart</Button> </Card.Body> </Card> </div> ) })} </div> ) } export default Med;

Esta es mi salida actual. pero quiero que muestre algo de texto después de la tarjeta de chris.

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

0

{data.slice(0,6).map((item,index)=>{//use the index to conditionally render })}

Edición n. ° 1: luego de leer su comentario, tal vez este código le dé una idea

 {data.slice(0, 6).map((item, index) => { return ( <div> {index < 3 ? <h1>First three</h1> : <h1>From Fourth</h1> </div> ); })}
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!