UNPKG

@splitsoftware/splitio-react

Version:

A React library to easily integrate and use Split JS SDK

23 lines (22 loc) 1.25 kB
import { __assign } from "tslib"; import * as React from 'react'; import { SplitClient } from './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. */ export function withSplitClient(splitKey, attributes) { return function withSplitClientHoc(WrappedComponent, updateOnSdkUpdate, updateOnSdkTimedout, updateOnSdkReady, updateOnSdkReadyFromCache) { return function wrapper(props) { return (React.createElement(SplitClient, { splitKey: splitKey, updateOnSdkUpdate: updateOnSdkUpdate, updateOnSdkTimedout: updateOnSdkTimedout, updateOnSdkReady: updateOnSdkReady, updateOnSdkReadyFromCache: updateOnSdkReadyFromCache, attributes: attributes }, function (splitProps) { return (React.createElement(WrappedComponent, __assign({}, props, splitProps))); })); }; }; }