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

303
Views
TypeError: props.items is undefined

What does this mean that the props.items are undefined? The parent component is supposed to pass the data down to the Users component. I've checked the Users component is correctly receiving the object with the data. So is there something wrong with the syntax in the JSX?

The error message:

TypeError: props.items is undefined
Users
C:/...src/components/Users/Users.js:3

  1 | function Users(props) {
  2 |   return (
> 3 |     <ul>
  4 |       {props.items.map((user) => (
  5 |         <div>
  6 |           {user.name} - {user.age}

The parent component:

import {useState} from 'react';
import Card from './components/UI/Card';
import Form from './components/Form/Form';
import users from './data/data';
import Users from './components/Users/Users';

function App() {
  const [userDB, setUserDB] = useState(users);
  function addUserToDB(user) {
    setUserDB(prevUsers => {
      return [user, ...prevUsers];
    });
  };

  return (
    <div>
      <Card>
        <Form onAddToDB={addUserToDB} />
      </Card>
      <Users userData={userDB} />
    </div>
  );
}

export default App;

The Users component where the error traces to:

function Users(props) {
  return (
    <ul>
      {props.items.map((user) => (
        <div>
          {user.name} - {user.age}
        </div>
      ))}
    </ul>
  );
}

export default Users;
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I guess you missed to pass the items prop to your Users or you should rename the userData prop.

      <Users items={userDB} />
about 4 years ago · Juan Pablo Isaza Report

0

What you are passing will ultimately comes inside props

Here

<Users userData={userDB} />

so props contains userData object only

so instead of

{props.items.map((user) => (...)

use

 {props.userData.map((user) => (...)
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!