@openfeature/react-sdk 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +27 -5
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -16,8 +16,8 @@
16
16
  <img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
17
17
  </a>
18
18
  <!-- x-release-please-start-version -->
19
- <a href="https://github.com/open-feature/js-sdk/releases/tag/react-sdk-v0.4.7">
20
- <img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.4.7&color=blue&style=for-the-badge" />
19
+ <a href="https://github.com/open-feature/js-sdk/releases/tag/react-sdk-v0.4.8">
20
+ <img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.4.8&color=blue&style=for-the-badge" />
21
21
  </a>
22
22
  <!-- x-release-please-end -->
23
23
  <br/>
@@ -54,6 +54,7 @@ In addition to the feature provided by the [web sdk](https://openfeature.dev/doc
54
54
  - [Re-rendering with Context Changes](#re-rendering-with-context-changes)
55
55
  - [Re-rendering with Flag Configuration Changes](#re-rendering-with-flag-configuration-changes)
56
56
  - [Suspense Support](#suspense-support)
57
+ - [Tracking](#tracking)
57
58
  - [Testing](#testing)
58
59
  - [FAQ and troubleshooting](#faq-and-troubleshooting)
59
60
  - [Resources](#resources)
@@ -132,7 +133,7 @@ function App() {
132
133
 
133
134
  #### Evaluation hooks
134
135
 
135
- Within the provider, you can use the various evaluation hooks to evaluate flags.
136
+ Within the provider, you can use the various evaluation hooks to evaluate flags.
136
137
 
137
138
  ```tsx
138
139
  function Page() {
@@ -236,7 +237,7 @@ Note that if your provider doesn't support updates, this configuration has no im
236
237
 
237
238
  #### Suspense Support
238
239
 
239
- > [!NOTE]
240
+ > [!NOTE]
240
241
  > React suspense is an experimental feature and subject to change in future versions.
241
242
 
242
243
 
@@ -274,11 +275,32 @@ function Fallback() {
274
275
  // component to render before READY.
275
276
  return <p>Waiting for provider to be ready...</p>;
276
277
  }
277
-
278
278
  ```
279
279
 
280
280
  This can be disabled in the hook options (or in the [OpenFeatureProvider](#openfeatureprovider-context-provider)).
281
281
 
282
+ #### Tracking
283
+
284
+ The tracking API allows you to use OpenFeature abstractions and objects to associate user actions with feature flag evaluations.
285
+ This is essential for robust experimentation powered by feature flags.
286
+ For example, a flag enhancing the appearance of a UI component might drive user engagement to a new feature; to test this hypothesis, telemetry collected by a [hook](#hooks) or [provider](#providers) can be associated with telemetry reported in the client's `track` function.
287
+
288
+ The React SDK includes a hook for firing tracking events in the <OpenFeatureProvider> context in use:
289
+
290
+ ```tsx
291
+ function MyComponent() {
292
+
293
+ // get a tracking function for this <OpenFeatureProvider>.
294
+ const { track } = useTrack();
295
+
296
+ // call the tracking event
297
+ // can be done in render, useEffect, or in handlers, depending on your use case
298
+ track(eventName, trackingDetails);
299
+
300
+ return <>...</>;
301
+ }
302
+ ```
303
+
282
304
  ### Testing
283
305
 
284
306
  The React SDK includes a built-in context provider for testing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfeature/react-sdk",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "OpenFeature React SDK",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "files": [
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "homepage": "https://github.com/open-feature/js-sdk#readme",
49
49
  "peerDependencies": {
50
- "@openfeature/web-sdk": "^1.2.2",
50
+ "@openfeature/web-sdk": "^1.3.0",
51
51
  "react": ">=16.8.0"
52
52
  },
53
53
  "devDependencies": {