i want to make all arrays in one array during a loop , example :
i have array of objects
[{1 ,2,3},{4,5,6}]
used function to convert each object to array [1 ,2,3] [4,5,6]
how i can merge both of this array to be one array [1,2,3,4,5,6]
and this is my code
const [start, setStart] = useState<Date[]>([]);
useEffect(() => {
publicHoliday?.map((holiday) => {
const eventStartDate = holiday.startDate;
const eventEndDate = holiday.endDate;
const holidayDates = enumerateDaysBetweenDates(eventStartDate, eventEndDate);
//holidayDates is array
//give me error here " Type 'Date | Date[]' is not assignable to type 'Date'.
Type 'Date[]' is missing the following properties from type 'Date': toDateString, toTimeString, toLocaleDateString, toLocaleTimeString, and 37 more.ts(2322)"
setStart([...start, holidayDates]);
return;
});
}, [publicHoliday]);
[{1 ,2,3},{4,5,6}]is not an array.