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

170
Views
How do I refetch data after specific event triggered (click a button) using SWR, React Hooks for Data Fetching

I have fetched data initially and based on the response deleted one from the database by clicking a button. Now I need to update UI/refetch data from the database. How do I do that? How do I handle state change and update UI using useSWR() React hook?

const fetcher = (url) => fetch(url).then((r) => r.json());

  const { data, error } = useSWR("url", fetcher);

  if (error) {
    return "Error while loading data"
  }

  if (!data) {
    return "data is loading";
  }
about 4 years ago · Juan Pablo Isaza
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!