Skip to content
Discussion options

You must be logged in to vote

You would have to make a useMutation hook so this would look like:

export const useMe = (query = GET_ME, fetchPolicy = 'cache-first') => {
  const meQuery = useQuery(query, { fetchPolicy });
  const [, updateUser] = useMutation(UPDATE_ME)
  if (meQuery.error) {
    console.log('useMe QUERY ERROR ==>', meQuery.error);
  }

  const user = meQuery.data?.user[0];

  return [user, executeQuery, updateMe];
};

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@GollyJer
Comment options

Answer selected by GollyJer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants