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;
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;
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)