Code Reference

Deep linking

React Native · Reference cheat sheet

Deep linking

React Native · Reference cheat sheet


📋 Overview

Deep links open a specific screen from a URL (myapp://profile/42 or https://…). Use React Navigation linking config or Expo Router path maps.

🔧 Core concepts

PieceRole
SchemeCustom URL scheme / universal links
Linking APILinking.getInitialURL, addEventListener
Navigation configMap path prefixes → screens
Expo RouterFile-based routes = URLs

💡 Examples

import * as Linking from 'expo-linking';

const url = Linking.createURL('profile/42');
// e.g. myapp://profile/42
import { Linking } from 'react-native';

Linking.addEventListener('url', ({ url }) => {
  // navigate from url
});

⚠️ Pitfalls

  • Test cold start (getInitialURL) and warm start (event) separately.
  • Universal links need platform domain association files.
  • Encode path params consistently.

On this page