← All posts

React Native with Expo: Build Mobile Apps With Your React Skills

Expo turns your React knowledge into real iOS and Android apps. Here is a practical intro — core components, StyleSheet, Expo Router navigation, and how to run on a real device in minutes.

Michael Cooper5 min readGreen belt

If you know React, you already understand most of React Native. The same component model, the same hooks, the same props-and-state data flow. What changes are the building blocks: instead of <div> and <p> you use platform primitives, and instead of CSS classes you use a JavaScript object API called StyleSheet.

Expo sits on top of React Native and handles the native build tooling so you don't have to touch Xcode or Android Studio during development. You can run your app on a real device in a few minutes using the Expo Go app, then graduate to a production build with Expo's EAS Build service when you're ready.

Creating a Project

bash
npx create-expo-app@latest my-app
cd my-app
npx expo start

Scan the QR code in your terminal with the Expo Go app (iOS or Android) and your app is running live on your device. Changes hot-reload instantly.

The default template uses Expo Router, a file-based navigation system that works almost identically to Next.js App Router.

Core Components

React Native ships no HTML elements. The main building blocks are:

| Web | React Native | |-----|-------------| | <div> | <View> | | <p>, <span>, <h1> | <Text> | | <img> | <Image> | | <input> | <TextInput> | | <button> | <TouchableOpacity>, <Pressable> | | <ul> with .map() | <FlatList> | | <div style="overflow: scroll"> | <ScrollView> |

Every visible element must be wrapped in a <View> or one of its specialised siblings. Text must live inside a <Text> component — you cannot render a bare string as a child of <View>.

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

export default function Hello() {
  return (
    <View style={styles.container}>
      <Text style={styles.heading}>Hello, React Native</Text>
      <Text style={styles.body}>Same hooks, different primitives.</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    padding: 16,
  },
  heading: {
    fontSize: 24,
    fontWeight: '700',
    marginBottom: 8,
  },
  body: {
    fontSize: 16,
    color: '#555',
  },
});

StyleSheet.create validates the object at startup and can optimise style IDs in production. The property names are camelCase versions of CSS — backgroundColor, marginBottom, borderRadius — and layout is Flexbox by default with flexDirection: 'column'.

Navigation With Expo Router

Expo Router uses the app/ directory exactly like Next.js App Router. Create a file, get a route.

app/
  _layout.tsx      ← root layout (Stack, Tabs, Drawer)
  index.tsx        ← maps to "/"
  profile.tsx      ← maps to "/profile"
  posts/
    [id].tsx       ← maps to "/posts/:id"

A simple tab layout:

tsx
// app/_layout.tsx
import { Tabs } from 'expo-router';

export default function RootLayout() {
  return (
    <Tabs>
      <Tabs.Screen name="index" options={{ title: 'Home' }} />
      <Tabs.Screen name="profile" options={{ title: 'Profile' }} />
    </Tabs>
  );
}

Navigate programmatically with the useRouter hook:

tsx
import { View, Text, TouchableOpacity } from 'react-native';
import { useRouter } from 'expo-router';

export default function HomeScreen() {
  const router = useRouter();

  return (
    <TouchableOpacity onPress={() => router.push('/profile')}>
      <Text>Go to Profile</Text>
    </TouchableOpacity>
  );
}

A Practical Example: Simple Counter

Here's a complete screen to illustrate state and event handling:

tsx
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
import { useState } from 'react';

export default function CounterScreen() {
  const [count, setCount] = useState(0);

  return (
    <View style={styles.container}>
      <Text style={styles.count}>{count}</Text>
      <View style={styles.row}>
        <TouchableOpacity
          style={[styles.button, styles.danger]}
          onPress={() => setCount(c => c - 1)}
        >
          <Text style={styles.buttonText}>−</Text>
        </TouchableOpacity>
        <TouchableOpacity
          style={[styles.button, styles.primary]}
          onPress={() => setCount(c => c + 1)}
        >
          <Text style={styles.buttonText}>+</Text>
        </TouchableOpacity>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, alignItems: 'center', justifyContent: 'center' },
  count: { fontSize: 72, fontWeight: '700', marginBottom: 32 },
  row: { flexDirection: 'row', gap: 16 },
  button: {
    width: 64,
    height: 64,
    borderRadius: 32,
    alignItems: 'center',
    justifyContent: 'center',
  },
  primary: { backgroundColor: '#3b82f6' },
  danger: { backgroundColor: '#ef4444' },
  buttonText: { color: '#fff', fontSize: 28, fontWeight: '700' },
});

No surprises: useState, event handlers, conditional styles with array syntax — identical concepts to React web.

Platform-Specific Code

When you need to diverge between iOS and Android, Platform.OS returns 'ios' or 'android':

tsx
import { Platform, StyleSheet } from 'react-native';

const styles = StyleSheet.create({
  shadow: {
    // iOS uses these shadow props
    shadowColor: '#000',
    shadowOffset: { width: 0, height: 2 },
    shadowOpacity: 0.1,
    shadowRadius: 4,
    // Android uses elevation
    elevation: 4,
  },
});

For larger divergences, name files component.ios.tsx and component.android.tsx and the bundler picks the right one automatically.

From Dev to Production

During development, npx expo start serves your app to Expo Go over the local network. When you're ready to ship:

  1. Development build — npx expo run:ios or npx expo run:android compiles a native binary with your app's native modules; use this once you add packages that have native code.
  2. EAS Build — eas build --platform ios (or android, or all) builds in Expo's cloud. No local Xcode or Android SDK required.
  3. EAS Submit — eas submit uploads the finished binary to the App Store or Play Store.

What to Know Before You Start

  • No CSS cascade. Styles don't inherit from parent components (except fontFamily inside nested <Text>). Every component styles itself.
  • No em, rem, or % for most properties. Use Dimensions.get('window') or the useWindowDimensions hook for responsive sizing.
  • Expo managed vs. bare workflow. Start with the managed workflow. Switch to bare only if you need a native module that Expo doesn't support through its Config Plugins.

If you already know React, the ramp-up to productive React Native development is genuinely short. The primitives feel unfamiliar for a day, then the muscle memory kicks in and you're writing the same kinds of components you always did.