skip to Main Content

Javascript – State update creates infinite loop

Why does assigning the setTimeSlotsList(fetchAPI(day)) create an infinite loop? The code flow seems to be working when I just console.log(fetchAPI(day)) for testing. const [timeSlotsList, setTimeSlotsList] = useState([]) function FormValues () { const { values } = useFormikContext(); const day =…

VIEW QUESTION
Back To Top
Search