What is React Native?

What is React Native?

I am a Software Developer with experience of building web apps primarily in Angular and Node.js. Now, learning React Native to start my professional journey of mobile development experience. Will be sharing my experiences with community.

React native is a JavaScript framework for building cross platform apps with much code reusability. It is like React, but it uses native components instead of web components as building blocks as it targets mobile platforms. It does not use HTML but use components that map to actual native IOS and Android components that render the app. In React, virtual DOM is used to render browser code in React while in React Native, native APIs are used to render components in mobile app.

If you already know React, you still need to learn some React-Native-specific stuff, like the native components. See below example

<div> in React will be <View> in React Native
<p> in React will be <Text> in React Native
<img> in React will be <Image> in React Native

One of the first things that surprises people about React Native is that it's "actually" native. Other JavaScript-for-mobile approaches wrap your JavaScript code in a glorified web view. They might re-implement some native UI behavior, like the animations, but you're still writing a web app. React Native only compiles your UI to native widgets, but not your business logic. Instead of compiling down to native code, React Native takes your application and runs it using the host platform's JavaScript engine, without blocking the main UI thread. You get the benefits of native performance, animations, and behavior, without having to write Objective-C or Java. Other cross-platform methods of app development, such as Cordova or Titanium, can never quite match this level of native performance or appearance.

If we talk about developer experience, React Native offers a much better developer experience. Because your application is mostly just JavaScript, you get a lot of the perks of web development, like being able to instantly "refresh" your application to see your code changes. If you have used android studio, you know that how much time and resources it takes to build app.

References:

  1. Reactjs vs React Native – Key Difference, Advantages, and Disadvantages

  2. What are the main differences between ReactJS and React-Native?

  3. Writing Cross-Platform Apps with React Native

  4. React Native Tutorial for Beginners - Crash Course 2020