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

308
Views
Reaccionar, representación condicional dentro del método de mapa

Tengo el siguiente código y quiero aplicar una representación condicional, porque el índice 0 no existe. No quiero mostrar la información para este índice en particular. ¿Cómo puedo hacerlo?

 return ( <section> {pokemonCards.map((pokemon, index) => <div key={index}> <img src={`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${index}.png`} alt={pokemon.name}/> <p>{pokemon.name}</p> </div> )} <button className="get-more-button" onClick={getMorePokemons}>Get more pokemons </button> </section> )
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Esto debería funcionar:

 return ( <section> {pokemonCards.map((pokemon, index) => {index === 0 ? null : <div key={index}> <img src={`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${index}.png`} alt={pokemon.name}/> <p>{pokemon.name}</p> </div> )} <button className="get-more-button" onClick={getMorePokemons}>Get more pokemons </button>} </section> )
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!