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

111
Views
ypeError: Cannot read properties of undefined (reading 'map')

im done it exactly like in the tutorial and mine is not working, i cant guess why, thanks for any help


import React from "react";
import Day from './Day';

function Month({ month }) {
    return (
        <div className="flex-1 grid grid-cols-7 grid-rows-5">
            {month.map((row, i) => (
                <React.Fragment key={i}>
                    {row.map((day, idx) => (
                        <Day day={day} key={idx} />
                    ))}
                </React.Fragment>
            ))}
        </div>
    )
}

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

0

The month or the row object are undefined in your code try optional chaining to make sure that your objects are not undefined or null.

import React from "react";
import Day from './Day';

function Month({ month }) {
    return (
        <div className="flex-1 grid grid-cols-7 grid-rows-5">
            {month?.map((row, i) => (
                <React.Fragment key={i}>
                    {row?.map((day, idx) => (
                        <Day day={day} key={idx} />
                    ))}
                </React.Fragment>
            ))}
        </div>
    )
}

export default Month;
about 4 years ago · Juan Pablo Isaza Report

0

You are probably mapping something that is not an array Be sure what you pass and read this page (https://www.w3schools.com/jsref/jsref_map.asp)

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!