hope you're doing good.
I'm working on an Advent / Chocolate Box Calendar in ReactJS and am trying to iterate over a for Loop for the number of days in December.
I have an issue understanding how to render it to my container in my return statement.
Here is the code in actual text:
const Calendar = () => {
// For Loop Here for each Day in December (31 Days)
for (let days = 31; days < array.length; days++) {
// Grid Item to Be Rendered for each Day
<Grid item>
<Box
sx={{
width: 300,
height: 300,
backgroundColor: 'primary.dark',
'&:hover': {
backgroundColor: 'primary.main',
opacity: [0.9, 0.8, 0.7],
},
}}
/>
</Grid>;
}
};
return (
<Grid container spacing={1}>
{/* Want To Generate <Grid item> Here Through for Loop */}
</Grid>
);
I want to be iterated over 31 times to amount for the total of days in December and render it in my return statement below the Grid component. I've tried to use an array to push the Grid item into and render it but it didn't work.
Any thoughts on how I could do this?
Thanks in advance
