Introduction to React Native
Your goal: Explain how a React Native app turns components into a mobile interface.
Before you begin: You should recognize JavaScript functions, imports, and strings (text values). You do not need mobile development experience. This lesson is a guided reading; you will run an app in the next lesson.
Start with a screen
Imagine a reading-list app. Its welcome screen contains a greeting, a book cover, and a button to continue. Instead of treating the screen as one large drawing, you can describe it as smaller pieces called components.
A component is a reusable piece of an interface. It can be as small as a label or as large as a whole screen. React lets you combine these pieces and describe what they should display.
React Native brings this approach to Android and iOS. Its built-in components connect your description to native interface elements—the building blocks provided by the phone’s platform. See the official introduction to native components.
React, React Native, and Expo
These names belong to different parts of the same toolkit:
| Tool | Its role | In our reading-list app |
|---|---|---|
| React | Describes and updates the interface using components. | Combines a greeting and a book card into a screen. |
| React Native | Provides mobile components and access to native capabilities. | Displays text and images on Android and iOS. |
| Expo | Provides a framework and development tools around React Native. | Helps create, run, and build the app. |
Using Expo means you are still learning React Native. The React Native team recommends a framework such as Expo for new apps. The next lesson uses that starting point.
Read one small component
Here is a complete screen component. Read it first; you do not need to create a file yet.
import { Text, View } from 'react-native';
export default function WelcomeScreen() {
return (
<View>
<Text>Welcome to your reading list!</Text>
</View>
);
}
The import makes React Native’s View and Text available in this file. WelcomeScreen is a JavaScript function that returns a description of the interface. export default lets another part of the app import and use it.
The tag-like syntax inside return is JSX. Here, it says “put a text element inside a container.” View groups elements; Text displays the greeting. Visible text belongs inside Text.
This is valid TypeScript, even though there are no extra type annotations. TypeScript adds checks to JavaScript to help catch mistakes while you work. Files containing TypeScript and JSX use the .tsx extension. We will introduce type annotations when an example needs them; see React Native’s TypeScript guide.
What appears on the phone?
The component describes the result: a container with a greeting. React Native uses that description to render the mobile interface. You do not write separate Android and iOS versions of this greeting.
On mobile, View and Text are native UI components, rather than HTML elements displayed in a browser. If you have written websites, the familiar tags can be misleading: use View and Text here, rather than div and p.
Sharing components also does not guarantee identical behavior everywhere. Screen sizes, keyboards, permissions, and platform conventions can differ. You should check your app on each platform you intend to support. Later, platform-specific code can handle differences when necessary.
Check your understanding
In the example above:
- Which component groups the content?
- Which component displays the greeting?
- If you create the app with Expo, are you still using React Native?
Compare your answers
View groups the content, and Text displays the greeting. Yes: Expo supplies tools around React Native, so these same components remain part of your app.
You are ready to continue when: You can explain the roles of React, React Native, and Expo in your own words.
Next: Understanding the React Native development environment. You will connect the tools to a working edit-and-refresh loop.