|
3 | 3 |
|
4 | 4 | React SDK v2.0.0 has a few breaking changes that you should consider when migrating from a previous version. The main changes are:
|
5 | 5 |
|
6 |
| -- **Deprecated `useClient`, `useTreatments`, and `useManager` hooks have been removed.** |
| 6 | +### • Deprecated `useClient`, `useTreatments`, and `useManager` hooks have been removed. |
7 | 7 |
|
8 |
| -Follow [this section](#migrating-to-get-react-sdk-v1100-improvements-replacing-the-deprecated-useclient-usetreatments-and-usemanager-hooks) to migrate to the new hooks `useSplitClient`, `useSplitTreatments`, and `useSplitManager` respectively. |
| 8 | +Follow [this section](#migrating-to-get-react-sdk-v1100-improvements-replacing-the-deprecated-useclient-usetreatments-and-usemanager-hooks) to migrate to the new hooks `useSplitClient`, `useSplitTreatments`, and `useSplitManager`. |
9 | 9 |
|
10 |
| -- **Deprecated `SplitFactory` provider has been removed, `withSplitFactory` is deprecated, and `SplitFactoryProvider` doesn't accept `updateOn` props and a render function as children anymore.** |
| 10 | +### • Deprecated `SplitFactory` provider has been removed, `withSplitFactory` is deprecated, and `SplitFactoryProvider` doesn't accept `updateOn` props and a render function as children anymore. |
11 | 11 |
|
12 | 12 | To migrate your existing code to the new version of `SplitFactoryProvider`, consider the following refactor example:
|
13 | 13 |
|
@@ -62,7 +62,7 @@ const App = () => {
|
62 | 62 | Notice that `MyComponent` was refactored to use the `useSplitClient` hook and is passed as a React JSX element rather than a render function.
|
63 | 63 | The `useSplitClient` hook is called without providing an `splitKey` param, meaning that the default client, which key is set in the `core.key` property of the `mySplitConfig` object, will be used, and the `updateOn` and `attributes` props are passed as options to the hook.
|
64 | 64 |
|
65 |
| -- **High-Order-Components (`withSplitClient`, `withSplitTreatments`) and components that accept a render function as child component (`SplitTreatments`, and `SplitClient`) have been deprecated and might be removed in a future major release.** |
| 65 | +### • High-Order-Components (`withSplitClient`, `withSplitTreatments`) and components that accept a render function as child component (`SplitTreatments`, and `SplitClient`) have been deprecated and might be removed in a future major release. |
66 | 66 |
|
67 | 67 | The deprecation is intended to simplify the API and discourage using old patterns (HOCs and render props) in favor of the *hook* alternatives, to take advantage of React optimizations.
|
68 | 68 |
|
@@ -158,7 +158,7 @@ const App = () => {
|
158 | 158 | };
|
159 | 159 | ```
|
160 | 160 |
|
161 |
| -- **Renamed `SplitSdk` function to `SplitFactory`.** |
| 161 | +### • Renamed `SplitSdk` function to `SplitFactory`. |
162 | 162 |
|
163 | 163 | If you are using the `SplitSdk` function to create a factory and pass it to the `SplitFactoryProvider` component, you should rename it to `SplitFactory`. For example:
|
164 | 164 |
|
@@ -192,9 +192,9 @@ const App = () => {
|
192 | 192 | };
|
193 | 193 | ```
|
194 | 194 |
|
195 |
| -- **Traffic type cannot be bound to SDK clients anymore.** |
| 195 | +### • Traffic type cannot be bound to SDK clients anymore. |
196 | 196 |
|
197 |
| -If you were passing the `trafficType` to the SDK config or the `useSplitClient` or `useTrack` hooks, you should remove it. The `trafficType` is now required to be passed as initial argument of the `track` method. For example: |
| 197 | +If you were passing the `trafficType` to the SDK config, `useSplitClient` hook, or `useTrack` hook, you should remove it. The `trafficType` must now be passed as the first argument of the `track` method. For example: |
198 | 198 |
|
199 | 199 | ```tsx
|
200 | 200 | const mySplitConfig = {
|
|
0 commit comments