UNPKG

@splitsoftware/splitio-react

Version:

A React library to easily integrate and use Split JS SDK

27 lines (26 loc) 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withSplitClient = void 0; var tslib_1 = require("tslib"); var React = (0, tslib_1.__importStar)(require("react")); var SplitClient_1 = require("./SplitClient"); /** * High-Order Component for SplitClient. * The wrapped component receives all the props of the container, * along with the passed props from SplitClient (see ISplitClientChildProps). * * @param splitKey - The customer identifier. * @param attributes - An object of type Attributes used to evaluate the feature flags. * * @deprecated `withSplitClient` will be removed in a future major release. We recommend replacing it with the `useSplitClient` hook. */ function withSplitClient(splitKey, attributes) { return function withSplitClientHoc(WrappedComponent, updateOnSdkUpdate, updateOnSdkTimedout, updateOnSdkReady, updateOnSdkReadyFromCache) { return function wrapper(props) { return (React.createElement(SplitClient_1.SplitClient, { splitKey: splitKey, updateOnSdkUpdate: updateOnSdkUpdate, updateOnSdkTimedout: updateOnSdkTimedout, updateOnSdkReady: updateOnSdkReady, updateOnSdkReadyFromCache: updateOnSdkReadyFromCache, attributes: attributes }, function (splitProps) { return (React.createElement(WrappedComponent, (0, tslib_1.__assign)({}, props, splitProps))); })); }; }; } exports.withSplitClient = withSplitClient;