Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
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? enter image description here

enter image description here

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

You can try to use the useQuery hook. It will consistently fetch the source for the data. Normally, you should not have any lags or delay: useQuery

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda