Hello developer! There is no such direction in which JavaScript has not launched its long hands, and this time it got to the native development of mobile applications for devices running Android and iOS. React Native is a great way to be fast and use your favorite tools out of the box (you don’t need to configure them, they work here and now): CSS, ES6, ES7, NPM, Yarn, etc. The creator of React Native is Facebook, a front-end leader, a company that invests huge resources in the development of its technologies. Facebook is actively developing React and React Native, creating a whole infrastructure and a powerful IT community around them. Another advantage of the technology is a fast-growing community of companies that use the technology, invest in it and support its development: GeekBrains, Yandex, Airbnb, Wix, Tesla, Soundcloud, Walmart. UberEats, FacebookGroups and partly Instagram and Facebook are written on this framework. Unlike React Native, such frameworks translate all the code into a WebView and remain essentially web applications, in React Native the code being developed is compiled into a native implementation, as if the application was written in Java or Objective-C. In this article, I touched the topic of installing the technology itself, a very labor-intensive task, I had to spend a lot of time to figure it out and clearly lay it out to you. Only the most important steps are collected here, but if you are doing this for the first time, I advise you to additionally look through the documentation. Let’s start from the beginning!
React Native is a JavaScript framework for creating natively displayed iOS and Android applications. React Native is based on the development of Facebook, another JavaScript library called React, developed to create user interfaces (UI). But instead of browsers, it targets mobile platforms. In simple words, on React Native we will write applications for the aios system, that is, for the iPhone, as well as for Android smartphones. In fact, this is the same ReactJS but for mobile platforms. If you have worked with React, then React Native will seem to you almost the same with the same comfortable platform. In order to successfully start studying this technology, you need to know HTML, CSS, JavaScript at a good level, and by any stretch, you need to understand the basic concepts of ReactJS. This is JSX, components, state, props, at least so. React Native was released only 4 years ago and is only gaining popularity. Even now, there are not many vacancies in Native and for beginners this is a very good chance, since the competition in this area is much less. Overall, the platform can do a lot. The only thing is that I don’t start doing games on it (perhaps it’s not created for this), complex animations can be made here, but you need to learn how. Non-complex and mid-level applications are done very well and pretty quickly. It perfectly handles different platforms, so you just need to write a React Native component and it will work without problems on one or another operating system. If you need to write code that depends on the platform in connection with different rules for interactions in iOS and Android, then this will not be difficult. React Native allows you to designate platform-dependent versions of each component that you can then integrate into your application. But there is one caveat: when developing with React Native, you will need a Mac. To create iOS applications, Apple forces users to use a Mac. This is an inevitable limitation for all developers. If you plan to develop only Android applications, then React provides support for Windows and Linux.
Well, let’s get down to the installation. There seems to be nothing difficult about this, React Native has very understandable documentation. What is required to install React Native and run the application? Fortunately, launching and configuring the toolkit to build your application is straightforward. Important: you need to understand that you must have node.js installed on your computer and npm. All you need is to download an app for your phone called Expo, a code editor and a terminal. This application is available in Google Play and App Store for download. If you do not want to install this application on your phone, then you can also register on the expo.io website, where you will have the opportunity to develop your application through your browser. I want to say right away that when I downloaded this application for the IPhone, to launch it I needed to add a project to “my projects” at expo.io. On Android, everything was easier, since it was enough to scan the QR code, which was kindly generated by the create-react-native-app utility. Our further actions are as follows:
- 1 – go to the terminal and install create-react-native-app globally, if it is not installed, with the command: npm install -g create-react-native-app.
- 2 – then create the project by entering the command: create-react-native-app MyApp;
- 3 – go to the project folder: cd MyApp.
- 4 – run the project: npm start.
All is ready. Now you can generate a QR code for your phone, scan it and write a native JavaScript application for your mobile devices.
It was an easy way to install, there is also React Native CLI Quickstart. This method is a little more difficult for beginners. You will need to install a little more, understand more and prescribe. Let’s say if you are developing on Windows (by the way, Windows do not support development for iOS – pay attention to this), but you can create something for Android. You will need to install using Chocolatey (this is a package manager for Windows), Java Development Kit, Python 2. You can do this using the instructions in the official documentation, just step by step, with all the commands and codes. You also install React Native CLI and, accordingly, Android Studio, then you will need to register some dependencies, environment variables and things like this. I repeat that everything is described in the official documentation, so you can try it if you like this method more.
Conclusion
In this article you have read about two ways to install React Native to start developing your mobile applications. EXPO CLI Quickstart is an easier installation option, because it allows you to launch a project without installing Android studio, that is, you can launch a project directly on your phone, no matter if it is Android or iPhone. Expo СLI sets up a development environment on your local computer and you can write an application in a few minutes. In order to see the result of your work in the browser, you can use snack.expo.io. There you write the code, press the “Tap to Play” button and everything is loaded. I hope the article was interesting, and the presented material is useful for you.