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?
