Expo Playground

Import Statements

Before you can use a building block like a button or a text box, you need to bring it into your file. That is what import does — it loads the pieces you need from other packages.

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

How imports work

Every React Native app is built from small, reusable pieces. The import statement tells JavaScript which pieces you need in the current file.

  • Named imports use curly braces: { View, Text } — you pick specific exports from the package.
  • Default imports have no braces: import React from "react" — the package chose one "main" export.

Why this matters in Expo

Expo provides dozens of packages (expo-camera, expo-location, etc.). Each one is imported separately so your app only bundles what it actually uses — keeping your app small and fast.

// Only the Camera component is bundled
import { Camera } from "expo-camera";

Tip: If you see a "module not found" error, you probably need to install the package first with npx expo install.

See this concept in action with interactive code highlighting

Try in Playground