DEV Community

Discussion on: What is react-query ? A CURD operation using react-query

Collapse
 
brandiqa profile image
Michael Wanyoike

Great article. I am using React Query 3, for the Delete mutation, I implemented it this way:

import axios from 'axios'
import { useMutation, useQueryClient } from 'react-query'

function App() {
  const deleteMutation = useMutation(
    (id) => axios.delete(`http://localhost:3004/users/${id}`),
    {
      onSuccess: () => {
        queryClient.invalidateQueries()
      },
    }
  )
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
karthick30 profile image
KaRthick

LG! yeah react query updated a lot !