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

287
Views
Module build failed (from ./node_modules/babel-loader/lib/index.js)

I have this code on my App.js:

import React, {useEffect, useState} from 'react'

function App() {

const [backendData, setBackendData] = useState([{}])

useEffect(() => {
fetch("/api").then(response => response.json()).then(
  data => {
    setBackendData(data)
  }
)
}, [])
 return (
  <div>
  {(typeof backendData.users === 'undefined') ? (
    <p>Loading...</p>
  ): (
    backendData.users.map(user, i) => (
      <p key={i}>
      {user}
    </p>
    ))
  
)}
</div>
)
}

 export default App

And i keep receiving this error:

ERROR in ./src/App.js

Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: E:\Interconnect\client\src\App.js: Unexpected token, expected "," (19:39)

THE LINE 19 is this one:

backendData.users.map(user, i) => (
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

The correct syntax is

backendData.users.map((user, i) => (
  <p key={i}>
    {user}
  </p>
))

with a pair of parentheses around the (user, i) => (...) function.

about 4 years ago · Santiago Gelvez 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!