Why does assigning the ‘setTimeSlotsList(fetchAPI(day))’ creates inifit loop?
the code flow seems to be working when i just ‘console.log(fetchAPI(day))’ for testing.
function FormValues () {
const { values } = useFormikContext();
const day = new Date(values.date)
useEffect(() => {
setTimeSlotsList(fetchAPI(day))
}, [values.date]);
}