I'm trying to fetch like 5 API which caused this error and now my page wont show anything. I've been told to use setTimout to fix it. But i never use setTimout and having hard time using it. Can someone show me the right way to setTimeout so it wont caused error.
The code
const [data, setData] = useState([]);
const loadData = async() =>{
const anime = await fetch(`https://api.jikan.moe/v4/top/anime`);
const value = await anime.json()
setData(value.data)
}
useEffect(() =>{
loadData();
},[])
Thank you.
You can use the setTimeout function using this code
setTimeout(() => {loadData();}, 3000);
Where 3000 is to execute in 3 seconds (time in miliseconds)
Hope that help u.
Regards.