Skip to content

Instantly share code, notes, and snippets.

@elmehdiabdi-src
elmehdiabdi-src / apollo-hooks.js
Last active October 21, 2019 15:54
apollo useQuery hooks :: vuejs
import { provide, inject, value, ref } from '@vue/composition-api';
const ApolloSymbol = Symbol()
export function provideContextToAppolo(context) {
provide(ApolloSymbol, context)
}
export function useApollo() {
const apollo = inject(ApolloSymbol)
return apollo.root.$apollo
}