
How to use React Native in VS Code: Setup and development guide
Table of contents
Quick Access

Visual Studio Code is one of the most popular code editors for React Native development thanks to its lightweight performance, extensive extension ecosystem, and powerful debugging capabilities. When properly configured, VS Code can significantly improve productivity and streamline the process of building cross-platform mobile applications.
Here, you'll learn how to use React Native in VS Code, from setting up your development environment to installing essential extensions and running your first project. We'll also cover best practices and tools that can help you write, test, and debug React Native applications more efficiently.
Installing and configuring the development environment
Installing Node.js and React Native CLI
React Native requires Node.js for package management. It is recommended to install the latest stable version of Node.js from its official site. Once installed, check the version with:
node -vnpm -v
Then, install the React Native CLI globally:
npm install -g react-native-cli
Alternatively, you can use npx to avoid installing packages globally:
npx react-native init MiAppcd MiApp

Setting up VS Code for React Native
VS Code is one of the best options for working with React Native thanks to its support for JavaScript and TypeScript, integrations with Git, and a wide variety of extensions.
Download VS Code from its official site and make sure to install the following recommended extensions for an optimal workflow:
- React Native Tools: Provides debugging and support for React Native.
- ESLint: Helps maintain clean and structured code.
- Prettier: Makes code formatting easier.
- Path Intellisense: Improves path auto-completion.
To install them, open VS Code, go to the extensions tab (Ctrl+Shift+X on Windows/Linux or Cmd+Shift+X on macOS) and search for them by name.
Creating and running a React Native project in VS Code
Project Initialization
If you haven't created a project yet, use the following command within VS Code:
npx react-native init MiAppcd MiAppcode .
This last command will open VS Code in the project directory.
Running the app on an emulator or physical device
To test your app on Android, you need to have Android Studio installed and set up an emulator or enable USB debugging on a physical device. Then, run:
npx react-native run-android
If you're working on macOS and want to run your app on iOS, you need Xcode:
npx react-native run-ios
To avoid errors with Metro Bundler, use:
npm start
If you're using Expo, just run:
npx expo start
Debugging React Native in VS Code
VS Code offers advanced debugging tools for React Native. The React Native Tools extension allows you to set breakpoints, inspect variables, and step through code.
To set up debugging:
- Open the debug panel (Ctrl+Shift+D on Windows/Linux or Cmd+Shift+D on macOS).
- Click "Add Configuration" and select "React Native".
- Select the platform you want to debug on (Android or iOS).
- Run the app and start debugging from VS Code.
If you experience issues with the debugger, try restarting Metro Bundler with:
npm start -- --reset-cache
Workflow Optimization
To improve development efficiency, consider the following practices:
Using TypeScript: Improves code security and maintainability. To use TypeScript, install the necessary dependencies:
npm install --save-dev typescript @types/react @types/react-native
- Hot Reloading: Allows you to see changes in real time without recompiling the application.
- Integration with GitHub Actions: Automates testing and deployments.
React Native and VS Code form a powerful development environment for creating cross-platform mobile applications. With the right configuration and the right tools, you can maximize your productivity and optimize the development of your projects.
However, to ensure a robust and scalable application, having a team of React Native experts is the best investment.
We recommend you on video
Related blogs

Legacy Core Banking Migration: 5 Engineering Lessons

Validating a Product Idea with AI: A Technical Guide

AI-Powered Product Discovery: Reduce Risks
