So I have a function to run async, so put async inside useEffect, in below is my code
useEffect(() => {
const data = async () => {
const data = await getAllVertification();
if (!data.status) {
} else {
setAlldata(data.data);
setLoadingAction([]);
let tmp = [];
for (const element of data.data) {
tmp.push({ status: false });
}
setLoadingAction(tmp);
}
};
data();
}, [update]);
but got waning like this
React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application.
To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
Can someone explain to me ?