[英]Loading Issue while refreshing the page in react js
I create the header nav bar.我创建了标题导航栏。 the data of the navbar is getting dynamically.
导航栏的数据是动态的。
const [navItem, setNavItem] = useState([]);
useEffect(() => {
fetch("https://localhost//wp-json/wp/v2/pages")
.then((res) => res.json())
.then((data) => {
data.sort((a, b) => a.id - b.id);
setNavItem(data);
});
}, []);
But the problem is when I refresh the page it take sometime to load the data.但问题是当我刷新页面时需要一些时间来加载数据。 But I don't want this how can I solve this issue?
但我不想要这个我该如何解决这个问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.