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