EU docs
$yarn add launchdarkly-react-client-sdk
1// Add the code below to the root of your React app.2import { StrictMode } from 'react';3import { createRoot } from 'react-dom/client';4import { LDProvider } from 'launchdarkly-react-client-sdk';56function App() {7 return <div>Let your feature flags fly!</div>8}910// A "context" is a data object representing users, devices, organizations, and other entities.11const context = {12 kind: 'user',13 key: 'EXAMPLE_CONTEXT_KEY',14 email: 'biz@face.dev',15};1617// This is your client-side ID.18createRoot(document.getElementById('root') as HTMLElement).render(19 <StrictMode>20 <LDProvider clientSideID="YOUR_CLIENT_SIDE_ID" context={context}>21 <App />22 </LDProvider>23 </StrictMode>,24);
You can find your server-side SDK keys, mobile keys, and client-side ID on the SDK keys page under Settings.
To learn more, read Initialize the client in the React Web SDK reference guide.