React Native

React Native is a framework developed by Meta. To create mobile and web applications is used.

Continue reading below

The framework comprises Node.js, a server development environment in which JavaScript is the language. 

At this time, the thing can be considered complicated, but trust me, it is a great framework that allows us to reduce the developing time intelligently. With this framework, you write the code once and to any device you build.

You develop one application and can build for both Android and iOS. As you can imagine, you reduce the development time a lot.

What is this framework used? 

You can develop mobile applications, like Android, Apple, and web-app. It is a last added feature. You can develop applications on any Windows, Linux, or Mac device. You must use a Mac to build and test Apple applications.

For example, I prefer to use the Linux environment, and once I finish the application development, or if I want to test the application, I must build and try it on my Mac. If you continue reading this article, I propose a solution to avoid this limit.

Without going into how to develop the code, I want to show you how simple this framework is because it is his strength.

First, you must start the react-native server, which lets you launch the application on any simulator or physical device. In the case of a web-app, you must start it on the browser. The server avoids building and then copies each time the developed application. In your terminal, you have all the logs, both the log you entered and in case the errors. You can always run the application on all the devices connected to your network.

At this point, you can appreciate how this framework makes life easy. To be clear, developing an application is not easy, but you can facilitate the development of the commons setup and save time.

How does it work?

React-native has a precise file structure; we can call it its working logic. Each package can be a module or an application. The package has the following configuration:

Starting from the beginning, the file App.js is the main application file, and then in this file, there is the whole application. In this file, commonly, we make a call to another class or function. I suggest dividing the code into many classes and functions for a clean code. Then not use one single file for the whole application. 

In the following, we have the index.js file. The last file (App.js) calls this file. The final file, but not for importance, is package.json. It is composed of a JavaScirpt object. This file contains all the application parameters, like the name, the version, the dependencies, the static variables and all the application parameters needed.

What are the dependencies?

As said, the last file contains the dependencies, but what are they?

They are all the needed packages. They are all the previously developed components that our application needs. This capacity is part of the value of React Native because you can add your previously developed package, but you can also add one of the ones you can find online. It lets us reduce the development time and avoid reinventing the wheel.

What does it mean that every package can be an application or a module?

Each package can have a dual use. It can be an application or a package used like a dependence.

How can we start a project?

You will now ask, ok, but how can I start an application from scratch? I’m pleased to announce that it will take less than 5 minutes. Once you install the needed programs, first of all, I suggest that you read the documentation (link). A good developer always reads the documentation, and most of the time, we find the solution to our problems in the documentation.

To start a project, once installed and configurated React-native, in this example, you find how to create a project in Linux, then digit in the terminal:

npx react-native init AwesomeProject

 In the following link, you will find the instructions for any device. Once you have followed the instruction, you must go into the package folder and then run the following command:

npx react-native start

At this time, you have a menu in the terminal, and following the instructions on the screen, you can run the application on the simulator or a physical device.

In this post, we have described an introduction to app development; it was a pleasure to see you there. If you want to get updated on the post-activity, please subscribe there.


Subscribe now and you will be updated for any news about the IoT word

Leave a Reply

Your email address will not be published. Required fields are marked *

Elisabetta Cataldi

© Copyright 2023 - All Rights Reserved
It was a pleasure see you there, we will see again