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

203
Vistas
In jsx use map() to render elements, same code firstone can't render out but the second one can

In this project I used NextJS JSX.

I try to use map() function to render the array element into link. In the return the first map() render nothing, but ***the second map() is render out links and show on browser.

This two pieces of map() are same, I have no idea why only the second map() is working.

import Link from 'next/link'
import { Fragment } from 'react'

import Nav from '../components/nav'

const Home = () =>{
  let navList = ["Home", "Project", "blog", "About"]

  return(
    <Fragment>
      {
        navList.map((navItem) => {
          navItem === "Home" ? 
          <Link href="/" key={navItem}><a>{navItem}</a></Link> : 
          <Link href={`../${navItem}`} key={navItem}><a>{navItem}</a></Link>
        })
      }

      {
        navList.map((navItem) => (
          navItem === "Home" ? 
          <Link href="/" key={navItem}><a>{navItem}</a></Link> : 
          <Link href={`../${navItem}`} key={navItem}><a>{navItem}</a></Link>
        ))
      }
    </Fragment>
  )
}

export default Home;
about 4 years ago · Juan Pablo Isaza
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