---
title: Install the React SDK
slug: feature-experimentation/docs/install-sdk-react-prior-to-v4
docTags: 
createdAt: 2026-08-05T20:39:51.000Z
---

The React SDK can be used in both ReactJS and React Native environments and is distributed through [npm](https://www.npmjs.com/package/@optimizely/react-sdk). The React SDK supports datafile caching and offline events persistence for React applications. Add it to your package with NPM:

```text
npm install --save @optimizely/react-sdk
```

or with Yarn:

```text
yarn add @optimizely/react-sdk
```

The full source code is at [https://github.com/optimizely/react-sdk](https://github.com/optimizely/react-sdk).

## Requirements

The React SDK requires an ES5-compatible environment, and `Promise`. To run in environments that do not support promise, you can use [promise-polyfill](https://www.npmjs.com/package/promise-polyfill).

### Peer dependencies

To use the features such as datafile caching and offline events persistence, you need to install the following peer dependencies in your React Native application.

```text
yarn add @react-native-async-storage/async-storage @react-native-community/netinfo
```

```text
npm install --save @react-native-async-storage/async-storage @react-native-community/netinfo
```

`@react-native-async-storage/async-storage` is required to:

- enable datafile caching by storing the datafile on the user's device.
- enable event offline persistence by temporarily storing events on user's device when offline.

`@react-native-community/netinfo` is required to detect when internet connectivity is restored, so that events triggered during the offline mode can be retried.
