Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

113
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda