VoidhashDocs
DevelopersHelp centerGuidesAPI reference
Dashboard
Get started
Introduction
Quickstart
How Voidhash works
Glossary
Versions and releases
Concepts
Teams, projects and environments
API keys
Products and perks
Offers
Subscription lifecycle
People and identity
Groups
Events
Features
Paywalls in your app
Feature flags and A/B tests
Paywall components
Push notifications
Ad attribution in your app
Client SDKs
React Native
Swift
Kotlin
Web
Your backend
Node.js
PHP
Go
Rust
Other languages
Payment sources
Forward store notifications
Developer tools
CLI
MCP server
Query analytics with VoidQL
React Native SDK
React Native quickstart
Display a paywall
Make and restore purchases
Check access
Identify users
Evaluate feature flags
Capture analytics
Groups
Track screens
Development mode
React Native SDK reference
Errors
Troubleshooting

Evaluate feature flags

Turn features on and pick variants per person, without an app release.

Voidhash evaluates feature flags for the current person, so one flag can be on for some people and off for others. You create flags and set their rollout in Studio; the SDK reads the result.

Early access

Feature flags are in early access. Ask us on Discord, or email support@voidhash.com on a paid plan, to turn them on for your team.

A build that uses a test key gets each flag's test configuration, which is the same as production's until you change it in Studio. See Environments.

Evaluate flags

Pass the keys you need. The hook compares keys by value, in any order, so an inline array doesn't cause extra requests:

import { voidhash } from "../src/lib/voidhash";

export function HomeScreen() {
  const { isEnabled, getVariant, isLoading } = voidhash.useFeatureFlags([
    "new-onboarding",
    "pricing-test",
  ]);

  if (isLoading) return null;

  const pricing = getVariant("pricing-test");
  return (
    <Home
      newOnboarding={isEnabled("new-onboarding")}
      pricingVariant={pricing?.enabled ? pricing.variantKey : null}
    />
  );
}

Omit the keys to evaluate every flag.

ValueMeaning
isEnabled(key)Whether the flag is on. false while loading and for unknown or disabled flags.
getVariant(key){ enabled, variantKey, payload }, or null while loading or for an unknown flag.
data.flagsEvery evaluated flag: key, enabled, variantKey, payload.
isLoading, error, refetchRequest state, and a way to evaluate again.

variantKey is null for a flag without variants. payload is untyped JSON, or null; validate it before use.

Outside React, client.getFeatureFlags(keys?) resolves to { flags, isStale }.

Defaults and caching

The SDK has no local defaults: a disabled, unknown or still-loading flag reads as off. Write your code so that off is the safe behavior.

Results are cached on the device and served from cache for 5 minutes. After that, a read answers from cache while a refresh runs, so flags keep working offline. The SDK also evaluates again at launch and on foreground. A change in Studio reaches the app at the next refresh.

Identity

Flags are evaluated per person. After identify(), signOut() or reset(), mounted hooks evaluate again for the new person. Rollouts bucket by person, so the same person gets the same answer on every device once identified.

Don't gate paid access on a flag. Use perks for that.

Next steps

  • Create flags and rollouts in Studio
  • A/B tests on paywalls
  • Capture events

Something wrong or missing on this page? Tell us by email or on Discord.

PreviousIdentify usersNextCapture analytics

On this page

Evaluate flagsDefaults and cachingIdentityNext steps