UNPKG

902 BJavaScriptView Raw
1import { invariant } from "../../utilities/globals/index.js";
2import * as React from 'react';
3import { getApolloContext } from "./ApolloContext.js";
4export var ApolloProvider = function (_a) {
5 var client = _a.client, children = _a.children;
6 var ApolloContext = getApolloContext();
7 return (React.createElement(ApolloContext.Consumer, null, function (context) {
8 if (context === void 0) { context = {}; }
9 if (client && context.client !== client) {
10 context = Object.assign({}, context, { client: client });
11 }
12 __DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
13 'sure you pass in your client via the "client" prop.') : invariant(context.client, 29);
14 return (React.createElement(ApolloContext.Provider, { value: context }, children));
15 }));
16};
17//# sourceMappingURL=ApolloProvider.js.map
\No newline at end of file