Install Realm for React Native
On this page
- Overview
- Prerequisites
- Installation
- Create a React Native Project
- Install Realm with NPM
- Resolve CocoaPods Dependencies
- Enable TypeScript (optional)
- Run the App
- Create a React Native Project
- Install Realm Using NPM
- Link the Realm Native Module
- Confirm the Link Step (Android)
- Enable TypeScript (optional)
- Run the App
- Import Realm
Overview
The Realm React Native SDK enables development of React Native applications using the JavaScript and TypeScript languages. React Native enables you to build cross-platform iOS and Android apps with a single codebase using the React framework.
Prerequisites
Before getting started, ensure your development environment meets the following prerequisites:
- React Native v0.31.0 or later. Follow the official React Native CLI Quickstart instructions to set up your environment.
- CocoaPods 1.10.1 or later (recommended for building an iOS app with React Native v.60+).
Expo now supports Realm with the Expo SDK version 44 only. To use Realm with Expo, upgrade to Expo SDK version 44. Realm does not work with earlier versions of Expo, or with Expo version 45.
For React Native version 0.64 and below, building your Realm React Native application requires additional steps in order to build your application when using Mac Catalyst.
Installation
Select the tab below that corresponds to your React Native version. Follow the steps to create a React Native project and add the Realm React Native SDK to it.
Import Realm
Add the following line to the top of your source files where you want to use Realm: