---
title: Real-Time Audiences for Feature Experimentation segment qualification methods for the React Native SDK
slug: feature-experimentation/docs/real-time-audiences-for-feature-experimentation-segment-qualification-methods-reactnative-prior-to-v4
docTags: 
createdAt: 2026-08-05T20:39:50.000Z
---

## Prerequisites

You must enable and configure [Real-Time Audiences for Feature Experimentation](docId:6UBBxxRv331nBIVZ2lun8) before fetching qualified segments and checking if the user is qualified for the given audience segment.

## fetchQualifiedSegments

### Minimum SDK Version

v3.0.0 or higher

### Description

You can use the `fetchQualifiedSegments` method to retrieve the external audience mapping for a specific user from the ODP server. The Optimizely Feature Experimentation React Native SDK provides an asynchronous version of the ODP `fetchQualifiedSegments` method.

`fetchQualfiedSegments` is a method of the `ReactSDKClient` object.

### Parameters

The following table describes the parameters for the `fetchQualifiedSegments` method:

| Parameter              | Type   | Description                                                |
| ---------------------- | ------ | ---------------------------------------------------------- |
| \`options\` (optional) | String | A set of options for fetching qualified segments from ODP. |

### Returns

This method returns a Promise`<bool>`, which resolves with `true` if segments are fetched, and `false` otherwise.

If the React Native SDK does not find an ODP audience in the datafile, it returns an empty qualified segments array without sending a request to the ODP server.

:::hint{type="info"}
You can read and write directly to the qualified segments array. This lets you bypass the remote fetching process from ODP or use your own fetching service. This can be helpful when testing or debugging.
:::

### Example `fetchQualifiedSegments` call

The following is an example of calling the `fetchQualifiedSegments` method and accessing the returned completion object:

```javascript
import { createInstance } from "@optimizely/react-sdk";

const optimizelyClient = createInstance({
  sdkKey: 'YOUR_SDK_KEY'
});

export default function App() {
  optimizelyClient.onReady().then(() => {
    optimizelyClient.fetchQualifiedSegments();
  });
 
  return (
  	<YourComponent />
  );
}
```

The following diagram shows the network calls between your application, the React Native SDK, and the ODP server when calling `fetchQualifiedSegments`:

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/8P5k80woANxVzlxzc1FTV_120a33d506afce1f981d568f0150f42470027a288139e760044eca134d951c2b-image.png)

1. Your application calls the `FetchQualifiedSegments` method.
2. The Feature Experimentation React Native SDK makes a GraphQL call to ODP to fetch segments the user ID qualifes for.
3. ODP responds with the qualified audience segments.
4. The React Native SDK automatically caches the fetched segments mapping the user ID to the qualified segments.
5. The `FetchQualifiedSegments` method returns a boolean if the qualified segments array was updated.
6. Call the [useDecision hook](docId\:Mz5kDck1FPop960mWpkTp) to get the flag decision result for a flag key.

After the audience segments are fetched, they are cached. This means that if you request the segments again (when new user contexts are created), the audience segment information can be retrieved from the cache instead of being fetched again from the remote ODP server.

The cache is used for the `fetchQualifiedSegments` call. This method is called on the user context (the user context is fixed, including the real-time audiences the user qualifies for).

The cache *only* applies when calling the `fetchQualifiedSegments` call. If you set the cache timeout to 0, the cache is disabled. Optimizely uses the least recently used (LRU) algorithm, so the oldest record is bumped out when the maximum size is reached. If there is a cache miss upon the method call, Optimizely makes a network request.

If you would like to bypass caching, you can add the following options to your `options `array:

- `OptimizelySegmentOption.IGNORE_CACHE` – Bypass segments cache for lookup and save.
- `OptimizelySegmentOption.RESET_CACHE` – Reset all segments cache.

## isQualifiedFor

### Minimum SDK version

3.0.0 or higher

### Description

Check if the user is qualified for the given audience segment.

### Parameters

The following table describes the parameters for the `isQualifiedFor` method:

| Parameter | Type   | Description                                                          |
| --------- | ------ | -------------------------------------------------------------------- |
| `segment` | string | The ODP audience segment name to check if the user is qualified for. |

### Returns

`true` if the user is qualified otherwise, `false`

### Examples

The following is an example of whether the user is qualified for an ODP segment:

```javascript
import { createInstance } from "@optimizely/react-sdk";

const optimizelyClient = createInstance({
  sdkKey: 'YOUR_SDK_KEY'
});

export default function App() {
  optimizelyClient.onReady().then(() => {
    optimizelyClient.fetchQualifiedSegments();
    const isQualifiedForSegment1 =  optimizelyClient.getUserContext()?.isQualifiedFor("segment1");
    console.log(isQualifiedForSegment1); // true
  });
 
  return (
    <YourComponent />
  );
}
```

## Source files

The language and platform source files containing the implementation for React Native are available on [Github](https://github.com/optimizely/react-sdk/blob/master/src/client.ts).
