Statsig SDK Quickstart Guide
Get data flowing into Statsig with only a few lines of code.
This quickstart guide is meant to get your implementation up and running as quickly as possible. Because of that, it only implements a standardized set of information. For a more detailed guide, go to the Statsig SDK Getting Started guide or read about choosing between client or server SDKs.
Install Statsig packages
bashnpm install @statsig/react-bindingsWrap your child components
Update your app's default function (typically App.tsx or Layout.tsx) so that the StatsigProvider component identifier wraps all child components.
tsximport { StatsigProvider } from "@statsig/react-bindings"; // [!code ++] export default function RootLayout({ children }: { children: React.ReactNode }) { return ( <StatsigProvider // [!code ++] sdkKey={"client-MY-STATSIG-CLIENT-KEY"} // [!code ++] user={{ userID: "quickstart-user" }} // [!code ++] loadingComponent={<div>Loading...</div>}> // [!code ++] {children} </StatsigProvider> // [!code ++] ); }This example assumes client-side React. For server-side rendering, refer to the Next.js docs.
Add a client key
Create a client API key in the Statsig console Settings. Copy and paste it to replace
<REPLACE_WITH_YOUR_CLIENT_KEY>in the code snippet from the previous step.Confirm the basic functions are working
Create a gate on the Feature Gates page in console and confiirm it works from within the code:
jsxconst { client } = useStatsigClient(); return ( <div>Gate is {client.checkGate('check_user') ? 'passing' : 'failing'}.</div> );
Next steps
You've set up the Statsig SDK in React. Continue with the SDK Quickstart tutorials, or go to the full Next.js or React SDK reference.
Was this helpful?
For AI agents: a documentation index is available at /llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.