UNPKG

@loona/react

Version:

App State Management done with GraphQL (react integration)

40 lines 1.68 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); } return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import * as React from 'react'; import * as PropTypes from 'prop-types'; import { ApolloConsumer } from 'react-apollo'; import { Loona } from './client'; import { LoonaContext } from './context'; var LoonaProvider = /** @class */ (function (_super) { __extends(LoonaProvider, _super); function LoonaProvider() { return _super !== null && _super.apply(this, arguments) || this; } LoonaProvider.prototype.render = function () { var _a = this.props, children = _a.children, loona = _a.loona, states = _a.states; return (React.createElement(ApolloConsumer, null, function (apolloClient) { return (React.createElement(LoonaContext.Provider, { value: { loona: new Loona(apolloClient, loona.manager, states), } }, children)); })); }; LoonaProvider.propTypes = { states: PropTypes.array, loona: PropTypes.object.isRequired, children: PropTypes.node.isRequired, }; return LoonaProvider; }(React.Component)); export { LoonaProvider }; //# sourceMappingURL=provider.js.map