# React quickstart

Wrap your app with the Dipswitch provider in React 19.3.1 or a later React 19 release. Use the public client key for your application and environment.

```sh
npm install @dipswitch/sdk-react
```

```tsx
import { DipswitchProvider, useFlag } from '@dipswitch/sdk-react'

function Checkout() {
  const enabled = useFlag('new-checkout', false)
  return <p>{enabled ? 'New checkout' : 'Checkout'}</p>
}

export function App() {
  return (
    <DipswitchProvider options={{ clientKey: 'ds_client_...', user: { id: 'user-42' } }}>
      <Checkout />
    </DipswitchProvider>
  )
}
```

Server rendering and the first render in the browser use the default. When flags load, `useFlag` updates the view. Use the client from `useDipswitch()` to change the current user. See [Verify user identity](/docs/identity/) if you need to pass a signature with that change.
