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

134
Views
How to do live delete data with react JS

I have some crud in my application. In react as we can know, we can do live crud concurrently with posting data to API. Like this:

const handleSubmit = async (someData:string) => {
        const result = await fetch('endpoint', {method:'POST', body:JSON.stringify(someData)})
        const data = await result.json()
        setDatas([...datas, data])
    }

And when we wanna delete them we can do this:

const handleDelete = async (id:string) => {
        const result = await fetch('endpoint', {method:'DELETE'})
        const data = await result.json()
        setDatas(datas.filter(data => data.id !== id))
}

But if we wanna add data and then delete it without refresh I can't delete the data, because I can't found id. How do I do it?

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!