apollor mutation update field code example
Example: how to update usequery after mutation in apollo client
// https://www.apollographql.com/docs/tutorial/local-state/
const [mutate, { loading, error }] = useMutation(
isBooked ? CANCEL_TRIP : TOGGLE_CART,
{
variables: { launchId: id },
refetchQueries: [
{
query: GET_LAUNCH_DETAILS,
variables: { launchId: id },
},
]
}
);