Documentation Index
Fetch the complete documentation index at: https://superflag.sh/docs/llms.txt
Use this file to discover all available pages before exploring further.
React Native SDK API Reference
Complete reference for all exports, types, and interfaces in@superflag-sh/react-native.
The React Native SDK has the same API as the React (web) SDK, but uses AsyncStorage instead of localStorage.
Components
SuperflagProvider
Context provider that wraps your app and manages flag state.| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
clientKey | string | No | env var | Public client key (pub_*) |
ttlSeconds | number | No | 60 | Cache TTL in seconds |
children | ReactNode | Yes | - | React children |
clientKey is not provided, the provider looks for:
process.env.EXPO_PUBLIC_SUPERFLAG_CLIENT_KEY(Expo)
Hooks
useFlag
Get the value of a feature flag with type safety.| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Flag key name |
fallback | T | No | Default value if flag not found |
T, or fallback if provided, or undefined.
Examples:
useFlags
Get the current SDK state.| Field | Type | Description |
|---|---|---|
flags | Flags | All flags as key-value pairs |
status | SuperflagStatus | Current SDK status |
ready | boolean | Shorthand for status === 'ready' |
loading | boolean | Shorthand for status === 'loading' |
version | number | null | Config version number |
etag | string | null | ETag from last fetch |
lastFetchedAt | number | null | Timestamp of last fetch |
error | string | null | Error message if failed |
Types
SuperflagStatus
| Status | Description |
|---|---|
idle | Initial state before fetching |
loading | Fetching flags from API |
ready | Flags loaded successfully |
error | Failed to load flags |
rate-limited | Monthly quota exceeded |
SuperflagState
Flags
SuperflagProviderProps
Constants
Cache Key
The SDK stores cached config under this AsyncStorage key:Exports
All exports from@superflag-sh/react-native:
Differences from React (Web) SDK
The React Native SDK differs from the React SDK in these ways:| Feature | React SDK | React Native SDK |
|---|---|---|
| Storage | localStorage | AsyncStorage |
| Custom storage prop | ✅ Supported | ❌ Not supported |
| Browser APIs | Assumes available | Checks existence first |
| Bundle output | Any bundler | Must use tsc |
TypeScript Usage
The SDK is fully typed. Import types alongside runtime exports:Next Steps
Usage Guide
Learn how to use the SDK in your app
Troubleshooting
Common issues and solutions