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

580
Views
Map Method not returning data on Nextjs

I'm trying to do a simple Map Method, the data 1,2,3,4,5 can be successfully shown in console.log, but not showing on the website.

import React from 'react'

export default function secretStashScreen() {
const numbers = [1, 2, 3, 4, 5];
  return (
    <div>
    {numbers.map((number)=>{<div>{number}</div>}) 
    }
    </div>
  )
}

Warning code after compiled:

warn  - Fast Refresh had to perform a full reload. Read more: https://nextjs.org/d
Error: Aborted because ./pages/secret-stash.js is not accepted
Update propagation: ./pages/secret-stash.js -> ./node_modules/next/dist/build/webp    at applyHandler (http://localhost:3000/_next/static/chunks/webpack.js?ts=16572
    at http://localhost:3000/_next/static/chunks/webpack.js?ts=1657263030521:564:2
    at Array.map (<anonymous>)

Is there anything I did wrong?

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

0

You should remove brackets in map for returning values

numbers.map((number)=><div>{number}</div>) 

If you want to keep brackets, you should have return explicitly

numbers.map((number)=>{return <div>{number}</div>}) 
about 4 years ago · Juan Pablo Isaza Report

0

Remove your {} bracket

{numbers.map((number)=><div>{number}</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!