@splitsoftware/splitio-react
Version:
A React library to easily integrate and use Split JS SDK
20 lines (19 loc) • 883 B
JavaScript
import * as React from 'react';
import { SplitContext } from './SplitContext';
import { useSplitClient } from './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.
*/
export function SplitClient(props) {
var children = props.children;
var context = useSplitClient(props);
return (React.createElement(SplitContext.Provider, { value: context }, typeof children === 'function' ?
children(context) :
children));
}