You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,3 +8,52 @@ This SDK is for client-side JS applications that run in a web browser. For serve
8
8
## Getting Started
9
9
10
10
Refer to our [SDK documentation](https://docs.geteppo.com/feature-flagging/randomization-sdk) for how to install and use the SDK.
11
+
12
+
## Usage with React
13
+
14
+
For usage in React applications, we recommend creating a [Context](https://reactjs.org/docs/context.html) provider to intialize the SDK and store the initialization status.
Use the context provider at the root of your component tree to wrap the rest of your application:
39
+
40
+
```tsx
41
+
<EppoProvider>
42
+
<MyApp />
43
+
</EppoProvider>
44
+
```
45
+
46
+
React components in your application should consume the context to check that the SDK has been initialized before assigning a variation. (Alternatively, you could have the `EppoProvider` wait to render its children until the SDK is initialized.)
0 commit comments