UNPKG

610 BJavaScriptView Raw
1import { invariant } from "../../utilities/globals/index.js";
2import { useContext } from 'react';
3import { getApolloContext } from "../context/index.js";
4export function useApolloClient(override) {
5 var context = useContext(getApolloContext());
6 var client = override || context.client;
7 __DEV__ ? invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
8 'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +
9 'instance in via options.') : invariant(!!client, 32);
10 return client;
11}
12//# sourceMappingURL=useApolloClient.js.map
\No newline at end of file