How do I install React Native?

NetDevices explains how to install React Native to start creating mobile applications. In fact, this framework has been developed to create native mobile applications for Android and iOS using JavaScript & React.

To do this, follow the steps described by your agency React Native.

Step 1: Prerequisites

Before you start, make sure you have installed Node.js (version 12 or later) with a package manager such as npm or Yarn on your system.

The Node.js installation check is then run by opening a terminal (or a command prompt on Windows) and executing the command " node -v". If Node.js is not installed, download it from https://nodejs.org and install it on your system.

Step 2: Install the React Native command-line tool (CLI)

The CLI for Command Line InterfaceThe React Native CLI is a tool that facilitates the creation, development and management of React Native projects. To install the React Native CLI, simply open a terminal and run the command "npm install -g react-native-cli" or "yarn global add react-native-cli".

Step 3: Create a new project React Native

After installing the CLI, use the following command to create a new React Native project with the name of your choice (for example, "MyApplication"): " react-native init MyApplication".

This creates a new folder with the name of your project. It then contains all the files you need to get started.

Step 4: Access the project file

Then navigate to your new project folder using the "cd" command: "cd MyApplication".

Step 5: Runapplication on an emulator or physical device

For Android :

  • Make sure you've installed Android Studio and configured the Android SDK environment with the necessary environment variables (such as ANDROID_HOME). For more information on configuring the Android environment, please consult the official documentation : https://reactnative.dev/docs/environment-setup
  • Launch the Android emulator (or connect a physical Android device with developer mode enabled).
  • Run the following command in the terminal: " react-native run-android".

For iOS :

  • Make sure you have installed Xcode, available from the Mac App Store.
  • Open the MyApplication.xcworkspace file located in your project's ios folder with Xcode.
  • Select an iOS simulator or connect a physical iOS device.
  • Then press the "Run" button to startapplication.

Congratulations! The installation of React Native is now complete. You can now launch and design your first application. You can also develop new features for your application by modifying the project's JavaScript files.

Would you like to find out more about development with React Native? Then don't hesitate to consult the official documentation at the following address: https://reactnative.dev/docs/getting-started or call on the expertise of our agency NetDevices.