Expo setup
- React Native course
- Beginner
- Lesson 2/116
- 5 min
Learn to create a React Native project with Expo CLI.
Expo setup
To start a new Expo project, you run npx create-expo-app my-app in the terminal. This command creates a folder named my-app and places all the initial project files inside it.
Once installation finishes, you change into the folder with cd my-app and start the development server with npx expo start. Expo manages dependencies automatically; you do not need Android Studio or Xcode.
This approach is the fastest way to get started with React Native.
Development server
The npx expo start command starts a development server. A QR code appears in the terminal; you scan it with Expo Go to open the app on your phone.
While the server runs, every change you save is reflected on the phone instantly. This fast feedback loop makes React Native development enjoyable.
In the terminal, you can press r to reload the app or j to open it in a browser.
Practice Write the App skeleton
Write a component named App. Its return statement should return <View> containing <Text>Hello</Text>.
Starter code
// Write the App component
function App() {
return null;
}Sample solution
function App() {
return (
<View>
<Text>Hello</Text>
</View>
);
}Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which command starts a new Expo project?
- npx create-expo-app Correct answer
- npm run expo
- expo new project
- react-native init expo
Explanation: npx create-expo-app creates a new project.
2 Match the files
| Term | Meaning |
|---|---|
App.js |
Entry component |
package.json |
Dependencies |
app.json |
Configuration |
assets |
Image resources |
3 Starting the server
To start the development server: npx ____ start
To start the development server: npx expo start
Explanation: npx expo start launches the server.