I am working on a project, where I am using conditional rendering. I am not sure what the cause but I am not getting data from api after refreshing the page.
Image of the page on first load
Image after a page refresh
This is obviously not the desired behavior, what am I missing here? This is my fetch request code:
useEffect(() => {
axios
.get(path)
.then((res) => {
setRoundData(res.data[1]);
setStudentData(res.data[2]);
setFilterData(res.data[2]);
})
.catch((err) => console.log(err));
}, [path]);