Wait for callback to finish
suppose I have this React/Javascript code:
Setstate not getting updated inside else block
As the call for compileProceduresApi is send it takes too much time to fetch. So after getting the response in case of failed response i want to open a modal which is written in “else” block. But the states setModalType and setOpenModal are not getting set. I have tried useEffect, promises, setTimeout but nothing is updating the state.