AppRegistry
React Native · Reference cheat sheet
AppRegistry
React Native · Reference cheat sheet
📋 Overview
AppRegistry is the JS entry that registers the root component. The native host looks up the app key and runs that component. Expo / CLI templates wire this for you.
🔧 Core concepts
AppRegistry.registerComponent(appKey, () => Root)— required entry.- App key — must match native (
AppDelegate/MainActivity/app.jsonname). runApplication— used by the native side; rarely called from app code.- Expo —
registerRootComponentfromexpowrapsAppRegistry.
💡 Examples
import { AppRegistry } from "react-native";
import App from "./App";
import { name as appName } from "./app.json";
AppRegistry.registerComponent(appName, () => App);// Expo
import { registerRootComponent } from "expo";
import App from "./App";
registerRootComponent(App);⚠️ Pitfalls
- Mismatched app name between JS and native → blank screen / redbox.
- Registering twice with different roots in the same bundle.
- Forgetting the factory
() => App(passingAppdirectly is also accepted in modern RN, but factory is the classic pattern).
🔗 Related
- basic_primitives.md — building UI
- Expo/filestructure.md — Expo entry
- Expo/config.md — app name / slug
- widget.md — alternate surfaces