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

153
Vistas
React js best way for live preview table

I wonder what is the best way for making table in react, live update. I'm doing it with setInterval, but I would like to know is there a way for making it without sending unnecessary requests to the server.

  const [data, setData] = useState([]);
  useEffect(() => {
    const interval = setInterval(() => {
      async function getData() {
        const result = await axios(
          "/api/data/?format=json"
        );
        setData(result.data);
        setLoadingData(false);
      }
      if (loadingData) {
        // if the result is not ready so you make the axios call
        getData();
      };
    }, 3000);
    return () => clearInterval(interval);
  }, []);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use web sockets to emit an event from the server to the connected clients. But, this involves change in the server code. I'm not sure if you have access to server code.

about 4 years ago · Juan Pablo Isaza 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