Code Reference

Getting Started with React Native

React Native · Reference cheat sheet

Getting Started with React Native

React Native · Reference cheat sheet


📋 Overview

React Native (RN) lets you build mobile apps with React. Instead of HTML tags (div, p), you use native components (View, Text). One codebase can target iOS and Android (and web via React Native for Web).

🔧 Core concepts

IdeaMeaning
Native componentsView, Text, Image, Pressable, …
StyleSheetJS objects for styling (Flexbox by default)
Metro / ExpoBundlers & tooling for RN apps
ExpoBeginner-friendly way to start without Xcode/Android Studio on day one
Platform APIsCamera, haptics, linking, etc. via modules

Recommended start: Expo (npx create-expo-app).

💡 Examples

Create an Expo app:

npx create-expo-app@latest MyApp
cd MyApp
npx expo start

Core imports:

import { View, Text, StyleSheet } from "react-native";

export default function App() {
  return (
    <View style={styles.container}>
      <Text style={styles.title}>Hello, React Native</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
  },
  title: { fontSize: 22 },
});

Platform check:

import { Platform, Text } from "react-native";

<Text>Running on {Platform.OS}</Text>;

⚠️ Pitfalls

  • There is no DOM — document / div / CSS files don’t apply the same way.
  • All text must be inside <Text> — raw strings in <View> error.
  • Flexbox defaults differ slightly from web (flexDirection: "column" by default).
  • Testing on a real device needs the Expo Go app or a dev build.

On this page