How to write query and mutation in same componnet?


I am trying to write Query and mutation in same react component.
But I am getting error for same identifier data & loading

x: Identifier 'data' has already been declared. (75:27)

You can’t declare two variables with the same name in the same scope.

You could do something like this:

const { data: queryData, loading: queryLoading } = useQuery(...queryArgs);
const { data: mutationData, loading: mutationLoading } = useMutation(...mutationArgs);