UNPKG

727 BJavaScriptView Raw
1import { __assign } from "tslib";
2import { invariant } from "../../utilities/globals/index.js";
3import * as React from "rehackt";
4import { getApolloContext } from "./ApolloContext.js";
5export var ApolloProvider = function (_a) {
6 var client = _a.client, children = _a.children;
7 var ApolloContext = getApolloContext();
8 var parentContext = React.useContext(ApolloContext);
9 var context = React.useMemo(function () {
10 return __assign(__assign({}, parentContext), { client: client || parentContext.client });
11 }, [parentContext, client]);
12 invariant(context.client, 47);
13 return (React.createElement(ApolloContext.Provider, { value: context }, children));
14};
15//# sourceMappingURL=ApolloProvider.js.map
\No newline at end of file