@apollo/client
Version:
A fully-featured caching GraphQL client.
17 lines • 902 B
JavaScript
import { invariant } from "../../utilities/globals/index.js";
import * as React from 'react';
import { getApolloContext } from "./ApolloContext.js";
export var ApolloProvider = function (_a) {
var client = _a.client, children = _a.children;
var ApolloContext = getApolloContext();
return (React.createElement(ApolloContext.Consumer, null, function (context) {
if (context === void 0) { context = {}; }
if (client && context.client !== client) {
context = Object.assign({}, context, { client: client });
}
__DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
'sure you pass in your client via the "client" prop.') : invariant(context.client, 29);
return (React.createElement(ApolloContext.Provider, { value: context }, children));
}));
};
//# sourceMappingURL=ApolloProvider.js.map