Skip to main content

React Native SDK for Statsig

Statsig client side SDK for applications in React Native not using Expo. If you are using Expo, check out our Expo SDK. This SDK is based on our JavaScript client SDK.

Installation

You can install the SDK via npm or yarn. In your project directory, run:

npm install statsig-react-native

Next, let's install the dependencies we need for the SDK to work:

npm install @react-native-async-storage/async-storage react-native-device-info react-native-get-random-values

Lastly, if you are on a Mac and developing for iOS, you need to install the pods to complete the linking:

npx pod-install ios # or pod install, in your /ios folder

Usage

import { StatsigProvider, useGate, useExperiment, useConfig, Statsig } from "statsig-react-native";

v4.X.X+

v4.X.X of our react-native SDK wraps the statsig-react sdk. It contains the same React Context, Providers, and Hooks, used in the same way. Get started with our suggested usage or the Provider and Hooks details.

It also exposes a global Statsig class that you can import outside your component tree to check gates/log events/etc.

import { Statsig } from "statsig-react-native";

...

Statsig.checkGate("gate_name");

Still Stuck?

Join our Slack community and chat with our Engineers and Data Scientists