cache를 직접 update
query를 refetch
const client = useApolloClient()
client.writeFragment({
id: `User: ${id}`,
fragment: gql`
fragment EditUser on User {
email
}
`
data: {
email: newEmail,
}
})
const { { ok }: data, refetch } = useQuery(GET_GREETING, {
variables: { language: 'english' },
});
if(ok) {
await refetch();
}
const [addTodo, { data }] = useMutation(ADD_TODO, {
refetchQueries: [{ query: TO_DO}],
});
https://www.apollographql.com/docs/react/caching
https://www.apollographql.com/docs/react/api/react/hooks/#usequery
https://www.apollographql.com/docs/react/api/react/hooks/#usemutation