Replies: 1 comment 1 reply
-
From what I can tell, the apollo client's strength is its caching and compat with the apollo server. With swrv, it is data fetching agnostic so you can do things like: import { request } from 'graphql-request'
const fetcher = query => request('/api/graphql', query)
export default {
setup () {
const { data, error } = useSWR(`{
Movie(title: "Inception") {
releaseDate
actors {
name
}
}
}`,
fetcher)
return { data, error }
} Which is nice if you want to fetch from an apollo server endpoint in one component, and a REST endpoint in the next. vue-apollo (vue's apollo client) is tailor made for gql so from what I can tell, you might find it useful if you're consuming an entirely apollo server. If someone with more graphql knowledge wants to weigh in, I'd love to hear the pros/cons and use cases. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey.
this is a really nice caching tool. I was wondering though, could it be possible to give SWRV the Apollo cache to "manage"? To me, this is a missing piece of Apollo Client's almost finished puzzle. The manual updating of the cache for "optimistic UI" seems like it should be automatable and SWRV is sort of that kind of automation, from what I understand. Just wondering.... 😃
Or, should SWRV just replace the cache? Hmmm.... 🤔
Scott
Beta Was this translation helpful? Give feedback.
All reactions