react native tutorial

React Native Tutorial- A Comprehensive Guide For Beginners

Vidhi Gupta
February 28th, 2024
10172
7:00 Minutes
Anyone who wishes to advance their career as a developer, must know that having React and React Native in their tool belt will be highly beneficial. Since using cross-platform frameworks for creating mobile apps is more in trend, it is best to get equipped with the right tools to make it happen. With a cross-platform app framework like React Native, you will find yourself with the prowess to develop native mobile apps that work well on both iOS and Android devices. This React Native tutorial will guide you to learn React Native with industry experts.

What is React Native?

Before we delve into how to learn or become React Native developer and teach you the steps to build an app on it, you should first know what is React Native.

React Native is a JavaScript (JS) framework that is used for building natively-rendering, cross-platform applications. Its basis lies in the React library that was created by Facebook. Those who belong to the web development field do not find it difficult to learn React Native.

React Native is used for rendering UI across various platforms including macOS, Windows, iOS, and Android. With a standard set of APIs to build user interface components, it facilitates developers in writing code only once, while running it on various platforms.

Is it Possible to Learn React Native Without React?

While you do not have to be an expert in either React or JS, a basic understanding will ensure you learn React Native faster, and without any hassles.

Since React Native makes use of React and JavaScript concepts for building native mobile apps, having a basic understanding and knowledge of React will certainly be an add-on.

To keep this article concise, I will only discuss how to set up React Native environment and Android studio to create and run your first react native app for Android OS.

React Native- Environment Setup

To set up the React Native environment, there are a few things that need to be installed. We are going to show you steps by using OSX as the building platform.

Step 1 - Install create-react-native-app

After you install NPM and NodeJS in the system, it's time to move ahead towards installing create-react-native app.

C:\Users\Tutorialspoint> npm install -g create-react-native-app

Step 2 - Create Project

Browse through the folder and move on to creating a new project using this command.

C:\Users\Tutorialspoint>cd DesktopC:\Users\Tutorialspoint\Desktop>create-react-native-app MyReactNative

Once this command is executed, a folder having this name will be created and have the following contents.

React Native Environment Setup

Step 3 - Install NodeJS, jdk8 & Python

Check if you have NodeJS, jdk8, and Python installed in your system. In case it isn't, install it. Additionally, installing the latest version of yarn is recommended to avoid certain issues.

Step 4 - Install React Native CLI

Use the below-mentioned command to install React Native command line interface on npm.

npm install -g react-native-cli
Install React Native CLI

Step 5 - Start React Native

Use the start command to verify the installation browser and start the project.

C:\Users\Tutorialspoint\Desktop>cd MyReactNativeC:\Users\Tutorialspoint\Desktop\MyReactNative>npm start

If everything works well, then you will see this QR code.

Start React Native

One way of running a React Native app on your Android device is via expo. Hence, you can scan this QR code by installing expo client in your Android device.

Step 6 - Eject the Project

To run Android emulator via Android Studio, you have to come out of the current command line. You can do so by pressing ctrl + c.

Consequently, run the eject command.

npm run eject

This will give you options to eject. Select the top one with arrows. Press enter.

Eject the React Native Project

Move on to suggesting the project name of the Xcode projects and Android Studio, along with naming the app on the home screen.

Eject React Native Project

NOTE: even after your project gets ejected successfully, an error like this may show.

Eject React Native App

You have to ignore this error. Use this command for running React Native for Android.

react-native run-android

However, you will need to install Android Studio prior to this.

Step 7 - Install Android Studio

To install and download Android Studio, visit https://developer.android.com/studio/.

Install Android Studio

Once you download the installation file, double click and move ahead with the installation.

Install Android Studio

Step 8 - Configure AVD Manager

In the menu bar, click on the respective icon to configure the AVD Manager.

Configure AVD Manager

Pick a device definition (Nexus 5X suggested).

Configure AVD Manager

Click Next > Select x86 Images tab > Select Marshmallow > Click Next > Click on the Finish button.

Configure AVD Manager
Configure AVD Manager
Configure AVD Manager

Now click the â–¶ button under the Actions column. This will start your Android Emulator.

Step 9 - Running Android

Open command prompt > go through the project folder > execute command (mentioned below).

react-native run-android
Run Android Project

The app execution will begin in another prompt. Its status can be seen.

Run Android Project

Your Android emulator will show you the execution of the default app like this

Run Android Project

Step 10 - local.properties

Go to Project folder > open the Android folder > create file local.properties > add path (mentioned below).

sdk.dir = /C:\\Users\\Tutorialspoint\\AppData\\Local\\Android\\Sdk

NOTE: replace tutorialspoint with a name of your choice.

Step 11 - Hot Reloading

To build an application, modify the App.js. The changes you make will automatically reflect on the Android Emulator.

In case it doesn't, click on Android Emulator > press ctrl + m > select Enable Hot Reloading.

How to Learn React Native Framework?

  1. Learn HTML & CSS

Since both HTML and CSS play the role of core technologies in the process of web development, mastering these two is important. Begin by learning CSS and HTML.

  1. Understand JavaScript

Learning JavaScript (JS) comes after you master HTML and CSS. JS is a scripting language that facilitates in adding logic and interactions to your web page. Familiarize yourself with the basic operations and the syntax, defining and calling functions, and understand how to declare objects and variables.

  1. Learn Virtual DOM & JSX

DOM or Document Object Model is a tree structure, which represents the current web page. Developers get enabled to programmatically access HTML elements with browser DOM API, and add the necessary business logic. JSX or JavaScript syntax extension is similar to HTML's syntax, is powerful, and handles JS expressions.

  1. Data Handling

Data can be handled internally with components using state. state and props are two key concepts in React. It is important to have good knowledge of data handling in React, as you would be doing it pretty often.

  1. Enroll in React Native Course

You must go for the best React Native course or React Native tutorial to learn React Native. While you can also watch a React Native bootcamp, there is nothing that can compare to a React Native training. Learn from industry experts and advance your skills in the field.

  1. Join React Native Community

While many people underestimate the importance of joining the React Native community, it should actually be given more focus. Joining their community will enable you to learn from industry experts, anytime, anywhere.

Conclusion

This is the right time to learn React Native with industry experts because the coming years are going to bring in more career opportunities in IT industry. Anyone who has a background in web development and wishes to expand their horizons, must go for this framework. With this React Native tutorial, you can easily learn and create your first mobile app without any hassle.

React Native Tutorial FAQs (Frequently Asked Questions)

Question. How long can it take to learn React Native?

Depending upon your current knowledge and skills, it can take anywhere between 2-6 months to learn this JS framework.

Question. Do I need to learn JavaScript for React Native?

Having knowledge of JavaScript's data types, object-oriented programming, functions, and syntax before getting into React Native development is important.

Question. Is React Native a good career?

Yes, React Native is certainly a good career as it opens numerous growth opportunities in the field of mobile development and cross-platform app development.

Image and content source- TutorialsPoint

Course Schedule

Course NameBatch TypeDetails
React Native Training
Every WeekdayView Details
React Native Training
Every WeekendView Details

Drop Us a Query

Fields marked * are mandatory
×

Your Shopping Cart


Your shopping cart is empty.