UNPKG

@splitsoftware/splitio-react

Version:

A React library to easily integrate and use Split JS SDK

21 lines (20 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SplitTreatments = void 0; var tslib_1 = require("tslib"); var React = (0, tslib_1.__importStar)(require("react")); var SplitContext_1 = require("./SplitContext"); var useSplitTreatments_1 = require("./useSplitTreatments"); /** * SplitTreatments accepts a list of feature flag names and optional attributes. It accesses the client at SplitContext to * call the 'client.getTreatmentsWithConfig()' method if the `names` prop is provided, or the 'client.getTreatmentsWithConfigByFlagSets()' method * if the `flagSets` prop is provided. It then passes the resulting treatments to a child component as a function. * * @deprecated `SplitTreatments` will be removed in a future major release. We recommend replacing it with the `useSplitTreatments` hook. */ function SplitTreatments(props) { var children = props.children; var context = (0, useSplitTreatments_1.useSplitTreatments)(props); return (React.createElement(SplitContext_1.SplitContext.Provider, { value: context }, children(context))); } exports.SplitTreatments = SplitTreatments;