UNPKG

@splitsoftware/splitio-react

Version:

A React library to easily integrate and use Split JS SDK

23 lines (22 loc) 1.28 kB
import { __assign } from "tslib"; import * as React from 'react'; import { SplitTreatments } from './SplitTreatments'; /** * High-Order Component for SplitTreatments. * The wrapped component receives all the props of the container, * along with the passed props from SplitTreatments (see ISplitTreatmentsChildProps). * * @param names - list of feature flag names * @param attributes - An object of type Attributes used to evaluate the feature flags. * * @deprecated `withSplitTreatments` will be removed in a future major release. We recommend replacing it with the `useSplitTreatments` hook. */ export function withSplitTreatments(names, attributes) { return function withSplitTreatmentsHoc(WrappedComponent, updateOnSdkUpdate, updateOnSdkTimedout, updateOnSdkReady, updateOnSdkReadyFromCache) { return function wrapper(props) { return (React.createElement(SplitTreatments, { names: names, updateOnSdkUpdate: updateOnSdkUpdate, updateOnSdkTimedout: updateOnSdkTimedout, updateOnSdkReady: updateOnSdkReady, updateOnSdkReadyFromCache: updateOnSdkReadyFromCache, attributes: attributes }, function (splitProps) { return (React.createElement(WrappedComponent, __assign({}, props, splitProps))); })); }; }; }