This article will help you install React Native easily and run your first React Native app on iOS.
First of all, let’s know What is React native?
React native is a Javascript framework which lets you write native mobile applications for iOs and Android in a single code base. It is from React, Javascript library built for the rich mobile User interface. The applications are built upon react native platform offers real look and feel of native ios or android platforms.
Environment setup
In this article, we will explain how to install react native and get you started native mobile apps development quickly. For this, we need to React Native CLI and we assume that you are already using Xcode or Android Studio for mobile apps development, otherwise please install Xcode or Android studio and then after following these steps.
Tools :
Homebrew, Node 8.3 or newer, React Native CLI, XCode 9.3 or newer for ios and newer Android Studio for Android platform.
Configuring Xcode Command line tool
And I am sure above advantages of Kotlin must have convinced you why to choose Kotlin for android app development.
Now go to the Locations panel (highlighted with red arrow) and install the tools by selecting the most recent version in the Command Line Tools dropdown (highlighted with red arrow).
Homebrew: We suggest installing Homebrew a powerful package manager for Mac,
brew install node brew install watchman |
Node is an open source, a cross-platform runtime environment for developing server-side and networking applications.
A Watchman is a tool by Facebook for watching changes in the filesystem.
Now installing React Native CLI
The React Native CLI (command line interface):
Node comes with npm, which lets you install the React Native command line interface.
Then run the following command :
npm install -g react-native-cli |
If you got an error, try the following command :
curl -0 -L https://npmjs.org/install.sh | sudo sh. |
It will take a while to install please have patience.
Creating a new application
Now we all set up to generate a new React Native project called “FirstReactProject”.
Run the following command,
react-native init FirstReactProject |
Now change directory to your project name and run following command
react-native run-ios |
For a specific simulator run below command, here we have used iPhone 8.
react-native run-ios –simulator=”iPhone 8″ |
Great! Here is the first look of your react native app
You can explore more options by hitting Cmd + D.