Apollo客户端3片段React

时间:2020-10-17 22:53:20

标签: javascript reactjs graphql react-apollo apollo-client

如何使用片段?因为我的代码没有片段

但是有片段,我得到204无内容响应。它在Apollo 3客户端上与o Apollo Boost不同吗?

import React, { useState, useMemo, Fragment } from 'react';
import { toast } from 'react-toastify';
import { useQuery, useMutation, gql } from '@apollo/client';


const USER_INFO = gql`
  fragment userInfo on User {
    _id
    name
    username
    email
    images {
      url
      public_id
    }
    about
    createdAt
    updatedAt
  }
`;

const PROFILE = gql`
  query {
    profile {
      ...userInfo
    }
  }
  ${USER_INFO}
`;

const USER_UPDATE = gql`
  mutation userUpdate($input: UserUpdateInput!) {
    userUpdate(input: $input) {
      ...userInfo
    }
  }
  ${USER_INFO}
`;

0 个答案:

没有答案