Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!