@splitsoftware/splitio-react
Version:
A React library to easily integrate and use Split JS SDK
25 lines (24 loc) • 1.11 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.SplitClient = void 0;
var tslib_1 = require("tslib");
var React = (0, tslib_1.__importStar)(require("react"));
var SplitContext_1 = require("./SplitContext");
var useSplitClient_1 = require("./useSplitClient");
/**
* SplitClient will initialize a new SDK client and listen for its events in order to update the Split Context.
* Children components will have access to the new client when accessing Split Context.
*
* The underlying SDK client can be changed during the component lifecycle
* if the component is updated with a different splitKey prop.
*
* @deprecated `SplitClient` will be removed in a future major release. We recommend replacing it with the `useSplitClient` hook.
*/
function SplitClient(props) {
var children = props.children;
var context = (0, useSplitClient_1.useSplitClient)(props);
return (React.createElement(SplitContext_1.SplitContext.Provider, { value: context }, typeof children === 'function' ?
children(context) :
children));
}
exports.SplitClient = SplitClient;
;