Apollo refetch hooks
npm install @habx/apollo-refetch



Displaying lists with apollo client is really common but it can be very
hard to update theses lists with new data or retrieve data from it. We wanted to be able to
display data that is always server-sync even if the list has parameters.
``shell`
npm i @habx/apollo-refetch
Wrap your App with the context provider
`typescript jsx`
{children}
`typescript`
const { refetch, ... } = useQuery
variables: {
filters: state.filters,
paginate: state.paginate,
orderBy: state.orderBy,
},
})
useRegisterRefetch('contacts', refetch)
typescript
const { refetch } = useRefetch()
const [handleUpsertContact] = useMutation<
upsertContact,
upsertContactVariabes
>(upsertContactMutation, { onCompleted: () => refetch('users')})
``And you're done š
ā ļø It's not useful to use
useRefetch` when the operation is an update