I'm setting my response value in setStatus function, but on the next line i'm not able to console status value, why is this happening and What can i do to make it work.
try {
//1st api call
axios.post(url, formData, config).then((response) => {
let uid = response.data;
let url2 = Constant.API_UID_STATUS_URL;
let url3 = Constant.API_FILE_DATA_URL;
console.log(uid, "response");
if (uid != null) {
axios
.get(url2 + new URLSearchParams({ uid: uid }))
.then((response) => {
setStatus(response.data);
console.log("status", status);
});
}
});
} catch (error) {
setIsDisabled(false);
console.log(error);
}