Bird
Raised Fist0
React Nativemobile~20 mins

Expo vs bare React Native - Build Both & Compare

Choose your learning style10 modes available
Build: Expo vs Bare React Native Comparison
This screen shows a simple comparison between Expo and bare React Native to help beginners understand the differences.
Target UI
----------------------------------
| Expo vs Bare React Native       |
|--------------------------------|
| Feature           | Expo | Bare |
|-------------------|------|------|
| Easy Setup        |  ✔   |  ✘   |
| Native Modules    |  ✘   |  ✔   |
| Over-the-Air Updates | ✔  |  ✘   |
| Custom Native Code | ✘   |  ✔   |
| Development Speed |  ✔   |  ✘   |
----------------------------------
Display a header with the screen name
Show a table comparing features of Expo and bare React Native
Use check marks (✔) and crosses (✘) to indicate support
Make the table easy to read with clear columns and rows
Starter Code
React Native
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

export default function ComparisonScreen() {
  return (
    <View style={styles.container}>
      {/* TODO: Add header and comparison table here */}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 16,
    backgroundColor: '#fff'
  }
});
Task 1
Task 2
Task 3
Solution
React Native
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

export default function ComparisonScreen() {
  return (
    <View style={styles.container}>
      <Text style={styles.header}>Expo vs Bare React Native</Text>
      <View style={styles.table}>
        <View style={[styles.row, styles.headerRow]}>
          <Text style={[styles.cell, styles.featureCell]}>Feature</Text>
          <Text style={styles.cell}>Expo</Text>
          <Text style={styles.cell}>Bare</Text>
        </View>
        {features.map(({feature, expo, bare}) => (
          <View key={feature} style={styles.row}>
            <Text style={[styles.cell, styles.featureCell]}>{feature}</Text>
            <Text style={styles.cell}>{expo ? '✔' : '✘'}</Text>
            <Text style={styles.cell}>{bare ? '✔' : '✘'}</Text>
          </View>
        ))}
      </View>
    </View>
  );
}

const features = [
  { feature: 'Easy Setup', expo: true, bare: false },
  { feature: 'Native Modules', expo: false, bare: true },
  { feature: 'Over-the-Air Updates', expo: true, bare: false },
  { feature: 'Custom Native Code', expo: false, bare: true },
  { feature: 'Development Speed', expo: true, bare: false }
];

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 16,
    backgroundColor: '#fff'
  },
  header: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 16,
    textAlign: 'center'
  },
  table: {
    borderWidth: 1,
    borderColor: '#ccc',
    borderRadius: 4
  },
  row: {
    flexDirection: 'row',
    borderBottomWidth: 1,
    borderColor: '#ccc',
    paddingVertical: 8,
    paddingHorizontal: 4,
    alignItems: 'center'
  },
  headerRow: {
    backgroundColor: '#f0f0f0'
  },
  cell: {
    flex: 1,
    textAlign: 'center',
    fontSize: 16
  },
  featureCell: {
    flex: 2,
    textAlign: 'left',
    paddingLeft: 8
  }
});

This screen uses a simple React Native functional component to show a comparison table.

We use a features array to store the feature names and whether Expo or bare React Native supports them.

The table is built with View components arranged in rows and columns using flexDirection: 'row'. Text components show the feature names and check marks or crosses.

Styling adds borders and spacing to make the table easy to read. The header is bold and centered.

This approach helps beginners see the differences clearly in a simple UI.

Final Result
Completed Screen
----------------------------------
| Expo vs Bare React Native       |
|--------------------------------|
| Feature           | Expo | Bare |
|-------------------|------|------|
| Easy Setup        |  ✔   |  ✘   |
| Native Modules    |  ✘   |  ✔   |
| Over-the-Air Updates | ✔  |  ✘   |
| Custom Native Code | ✘   |  ✔   |
| Development Speed |  ✔   |  ✘   |
----------------------------------
Screen is static with no interactive elements
User can scroll if screen is small
Clear visual difference between Expo and bare React Native features
Stretch Goal
Add a toggle button to switch between light and dark mode for the comparison screen.
💡 Hint
Use React state to track the mode and change background and text colors accordingly.

Practice

(1/5)
1. Which statement best describes Expo in React Native development?
easy
A. Expo provides an easy setup with many built-in tools and services.
B. Expo requires manual linking of native modules for every feature.
C. Expo does not support running apps on physical devices.
D. Expo is only for web development, not mobile apps.

Solution

  1. Step 1: Understand Expo's purpose

    Expo is designed to simplify React Native development by providing many built-in tools and services out of the box.
  2. Step 2: Compare with other options

    Unlike bare React Native, Expo does not require manual linking of native modules and supports running apps on physical devices easily.
  3. Final Answer:

    Expo provides an easy setup with many built-in tools and services. -> Option A
  4. Quick Check:

    Expo = Easy setup and built-in tools [OK]
Hint: Expo means easy start with many tools included [OK]
Common Mistakes:
  • Thinking Expo requires manual native code linking
  • Believing Expo can't run on real devices
  • Confusing Expo with web-only frameworks
2. Which of the following is the correct way to start a new Expo project?
easy
A. npx react-native init MyApp
B. react-native run-ios
C. npm create-react-app MyApp
D. expo init MyApp

Solution

  1. Step 1: Identify Expo project creation command

    The command expo init MyApp is used to create a new Expo project with templates and setup.
  2. Step 2: Differentiate from bare React Native commands

    npx react-native init is for bare React Native, not Expo. Other options are unrelated or for web.
  3. Final Answer:

    expo init MyApp -> Option D
  4. Quick Check:

    Expo project start = expo init [OK]
Hint: Expo projects start with 'expo init' command [OK]
Common Mistakes:
  • Using 'npx react-native init' for Expo projects
  • Confusing React web commands with React Native
  • Trying to run iOS build command before project creation
3. What will happen if you try to use a native module not supported by Expo in an Expo managed project?
medium
A. The app will build and run without errors.
B. You will get a build error or runtime crash.
C. Expo automatically adds support for all native modules.
D. The app will silently ignore the native module.

Solution

  1. Step 1: Understand Expo's native module support

    Expo supports many native modules but not all. Unsupported modules cause build or runtime errors.
  2. Step 2: Predict behavior when using unsupported modules

    Since Expo does not allow custom native code in managed workflow, using unsupported native modules leads to errors.
  3. Final Answer:

    You will get a build error or runtime crash. -> Option B
  4. Quick Check:

    Unsupported native module in Expo = error [OK]
Hint: Unsupported native modules cause errors in Expo [OK]
Common Mistakes:
  • Assuming Expo adds all native modules automatically
  • Thinking unsupported modules are ignored silently
  • Believing Expo supports all bare React Native features
4. You have a React Native app created with Expo but need to add custom native code. What is the best way to fix this?
medium
A. Eject the Expo project to bare React Native workflow.
B. Keep using Expo and add native code directly.
C. Rewrite the app using React web instead.
D. Use Expo's managed workflow without changes.

Solution

  1. Step 1: Identify the limitation of Expo managed workflow

    Expo managed workflow does not allow adding custom native code directly.
  2. Step 2: Choose the correct approach to add native code

    Ejecting the Expo project converts it to bare React Native, allowing full native code access.
  3. Final Answer:

    Eject the Expo project to bare React Native workflow. -> Option A
  4. Quick Check:

    Need native code? Eject Expo [OK]
Hint: Eject Expo to add custom native code [OK]
Common Mistakes:
  • Trying to add native code in Expo managed workflow
  • Ignoring the need to eject before native code
  • Switching to React web instead of native
5. You want to build a complex app with custom native modules and full control over build tools. Which approach is best?
hard
A. Build a web app instead of a mobile app.
B. Use Expo managed workflow for faster development.
C. Start with bare React Native to access native code freely.
D. Use Expo and avoid any native code.

Solution

  1. Step 1: Analyze app requirements

    The app needs custom native modules and full control over build tools, which Expo managed workflow limits.
  2. Step 2: Choose the suitable React Native approach

    Bare React Native allows direct native code access and full control over build configurations, fitting the requirements.
  3. Final Answer:

    Start with bare React Native to access native code freely. -> Option C
  4. Quick Check:

    Custom native + control = bare React Native [OK]
Hint: Complex native needs? Choose bare React Native [OK]
Common Mistakes:
  • Choosing Expo for apps needing custom native code
  • Confusing web apps with native mobile apps
  • Avoiding bare React Native despite native needs
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard