Skip to content

TypeScript code snippet – 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 },
        },
      ]
    }
  );
See also  Get all dates within range in react js

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.