React Native Feature Flags installation
Install with the wizard
Run this command in your project directory to add PostHog to your React Native project. The wizard detects your framework, installs the SDK, and sets up your first events.
Or set it up manually by following the rest of this guide.
- 1
Install the package
RequiredInstall the PostHog React Native library and its dependencies:
- 2
Configure PostHog
RequiredPostHog is most easily used via the
PostHogProvidercomponent. Wrap your app with the provider:App.tsx - 3
Send events
RecommendedOnce installed, PostHog will automatically start capturing events. You can also manually send events using the
usePostHoghook:Component.tsx - 4
Use feature flags
RequiredPostHog provides hooks to make it easy to use feature flags in your React Native app. Use
useFeatureFlagEnabledfor boolean flags:Component.tsxMultivariate flags
For multivariate flags, use
getFeatureFlag:Component.tsx - 5
Running experiments
OptionalExperiments run on top of our feature flags. Once you've implemented the flag in your code, you run an experiment by creating a new experiment in the PostHog dashboard.
- 6
Next steps
RecommendedNow that you're evaluating flags, continue with the resources below to learn what else Feature Flags enables within the PostHog platform.
Resource Description Creating a feature flag How to create a feature flag in PostHog Adding feature flag code How to check flags in your code for all platforms Framework-specific guides Setup guides for React Native, Next.js, Flutter, and other frameworks How to do a phased rollout Gradually roll out features to minimize risk More tutorials Other real-world examples and use cases





