Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

destroy.jsx

10 lines289 Bytes

1import { redirect } from 'react-router-dom'
2import { deleteContact } from '../contacts'
3​
4export const action =
5 (queryClient) =>
6 async ({ params }) => {
7 await deleteContact(params.contactId)
8 queryClient.invalidateQueries({ queryKey: ['contacts'] })
9 return redirect('/')
10 }