Skip to content

Commit 709a35b

Browse files
Update comments and metadata
1 parent b35dc78 commit 709a35b

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Below is a simple example that describes the instantiation and most basic usage
1818
import React from 'react';
1919

2020
// Import SDK functions
21-
import { SplitFactoryProvider, useSplitTreatments } from '@splitsoftware/splitio-react';
21+
import { SplitFactoryProvider, useTreatment } from '@splitsoftware/splitio-react';
2222

2323
// Define your config object
2424
const CONFIG = {
@@ -29,18 +29,18 @@ const CONFIG = {
2929
};
3030

3131
function MyComponent() {
32-
// Evaluate feature flags with useSplitTreatments hook
33-
const { treatments: { FEATURE_FLAG_NAME }, isReady } = useSplitTreatments({ names: ['FEATURE_FLAG_NAME'] });
32+
// Evaluate a feature flag with useTreatment hook
33+
const { treatment, isReady } = useTreatment({ name: 'FEATURE_FLAG_NAME' });
3434

3535
// Check SDK readiness using isReady prop
3636
if (!isReady) return <div>Loading SDK ...</div>;
3737

38-
if (FEATURE_FLAG_NAME.treatment === 'on') {
39-
// return JSX for on treatment
40-
} else if (FEATURE_FLAG_NAME.treatment === 'off') {
41-
// return JSX for off treatment
38+
if (treatment === 'on') {
39+
// return JSX for 'on' treatment
40+
} else if (treatment === 'off') {
41+
// return JSX for 'off' treatment
4242
} else {
43-
// return JSX for control treatment
43+
// return JSX for 'control' treatment
4444
};
4545
}
4646

src/SplitClient.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import { useSplitClient } from './useSplitClient';
99
*
1010
* The underlying SDK client can be changed during the component lifecycle
1111
* if the component is updated with a different splitKey prop.
12-
*
13-
* @deprecated `SplitClient` will be removed in a future major release. We recommend replacing it with the `useSplitClient` hook.
1412
*/
1513
export function SplitClient(props: ISplitClientProps) {
1614
const { children } = props;

src/SplitTreatments.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useSplitTreatments } from './useSplitTreatments';
99
* call the 'client.getTreatmentsWithConfig()' method if the `names` prop is provided, or the 'client.getTreatmentsWithConfigByFlagSets()' method
1010
* if the `flagSets` prop is provided. It then passes the resulting treatments to a child component as a function.
1111
*
12-
* @deprecated `SplitTreatments` will be removed in a future major release. We recommend replacing it with the `useSplitTreatments` hook.
12+
* @deprecated `SplitTreatments` will be removed in a future major release. We recommend replacing it with the `useTreatment*` hooks.
1313
*/
1414
export function SplitTreatments(props: ISplitTreatmentsProps) {
1515
const { children } = props;

src/withSplitTreatments.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { SplitTreatments } from './SplitTreatments';
1010
* @param names - list of feature flag names
1111
* @param attributes - An object of type Attributes used to evaluate the feature flags.
1212
*
13-
* @deprecated `withSplitTreatments` will be removed in a future major release. We recommend replacing it with the `useSplitTreatments` hook.
13+
* @deprecated `withSplitTreatments` will be removed in a future major release. We recommend replacing it with the `useTreatment*` hooks.
1414
*/
1515
export function withSplitTreatments(names: string[], attributes?: SplitIO.Attributes) {
1616

0 commit comments

Comments
 (0)