Why do we like native apps so much? Why, if we need to order a taxi, we do not go to gett.com or uber.com through the browser, but order a taxi through the application? Ordering a taxi through the app is much more convenient. Gett and Uber simply do not have web applications: people are already so used to using native ones that today it is very difficult to be competitive without them. And react native developers for hire are always available to solve this task.
Of course, there are very specific reasons for the popularity of native apps:
- Fast and responsive. Native applications are usually low-level optimized for the platform they run on.
- Support for complex gestures and non-trivial animations.
- Uniform UI. The interface of different applications within the same OS is built approximately the same: of course, the components vary from application to application, but the principle of operation is approximately the same. That is, if you understand the interface of one application, it will be easier for you to understand the interface of other applications on the same OS.
Despite the popularity of native apps, it is quite difficult to create them for the following reasons:
Different set of technologies: for example, if you need to make the same app for Android and iOS, you have to hire both Android developers and iOS developers – and this, of course, is more expensive.
Since the technologies are different, there is no code reuse. For example, if you need to send a REST API request to a cloud server, you have to write a service layer for both Android and iOS. Then we have to write the same UI twice, write one function twice, and so on.
You have to make a new assembly for each change, which takes a lot of time and slows down the iteration speed.
Applying web programming solves all these problems:
- There is only one set of technologies: it is enough for us to know HTML, JS and CSS.
- Lots of reusable code: A huge number of JS libraries can be found.
- Easy to make changes – just refresh the page to see them.
For these reasons, the web approach was tried on mobile applications – for this there are tools such as PhoneGap, Appcelerator Titanium, Ionic, etc. They take a WebView and present it as a native application, but in reality it is just HTML , JS and CSS.
In principle, this approach works, but no matter how hard you try, you still won’t be able to do everything as beautifully as in a real native application (for example, it will be very difficult to make animated edges that we are used to in iOS).
In the past, many companies have relied on the use of HTML5 in applications – for example, Facebook, until Zuckerberg announced in 2012 that they were abandoning this approach. And in 2015, Facebook released its first React Native app – Ads Manager, an ad management app. There is slight difference between react native and flutter.
Before React Native came along, we had to decide whether we needed to sacrifice user-friendliness or developer-friendliness. In other words, which to choose – cheaper and easier development at the expense of the user experience, or an amazing user experience but complex and expensive development? Facebook decided that both were important and created React Native.
What is React Native? It is a JS framework based on JS and React – a JS library for creating a UI (View layer).
The concept behind React Native is very simple. I’ll illustrate it with the following example: Let’s say I have a very simple application consisting of an “add + 1” button and a “count” element that increments by 1 when the button is clicked.
How is it written?
With the UI = f (count) function, React Native is perhaps the quintessential component approach. Any atomic element is a component. A component is, in fact, a function that takes a set of parameters as input, and always gives the same output at the output for a given set of input parameters. That is, the execution of the function does not depend on the environment – the function is isolated.