Why use React Native? | Seamless Mobile Experiences, One Codebase

Back in the day, the options for developing mobile applications were rather limited. You could basically choose between building your app twice, meaning the duplication of logic and structure for both major platforms iOS and Android, or you could use some framework like Apache Cordova or Adobe Phonegap. These frameworks allow the creation of so-called hybrid apps that allow code to be reused across platforms and also provide access to native device APIs. However, the main downside of hybrid apps is that they are rendering components in webviews, which not only makes your application slow, but it also feels slow for users in terms of responsiveness. Wouldn’t it be great to leverage the benefits of hybrid apps while ensuring that your app is faster than just a web application wrapped inside of a browser view? That’s where React Native comes in.

What is React Native?

React Native is a JavaScript framework for building native mobile applications. It is based on React and actively maintained by Meta (formerly Facebook). Many popular apps are using React Native, including Facebook, Microsoft Teams, Discord and many more. To find out why, let’s dive into the architecture of React Native.

While components are written in React, the actual rendering is done using the native APIs of the respective platform instead of using webviews. This makes for a much faster and more responsive user experience.

React-Native-2

The React Native bridge converts React Native components written in React into their platform-specific native equivalents like Android.View (Android), UIView (iOS), and div (HTML).

React Native provides some basic components like View, Text, Image, and ScrollView, which map directly to the platform’s native components. Apart from that, many third-party libraries are available on npm that provide additional components and functionalities.

React-Native-1

Component composition of a React Native app

Getting started with React Native as a React developer

As a React developer, you’re probably already confident with the basics of state management, React hooks and JSX.

The good news is that this knowledge is the base for learning React Native. The way to write components or views in React Native needs some getting used to when coming from a web development background, but is not very complicated. While in React regular HTML elements like <div>, <p> or <img> are used, in React Native you will use components like <View>, <Text> or <Image>. The following table provides a great overview of the most common components in React Native, their corresponding Android and iOS components and their equivalent in web development:

React Native UI ComponentAndroid ViewiOS ViewWeb AnalogDescription<View><ViewGroup><UIView>A non-scrolling <div>A container that supports layout with flexbox, style, some touch handling, and accessibility controls<Text><TextView><UITextView><p>Displays, styles, and nests strings of text and even handles touch events<Image><ImageView><UIImageView><img>Displays different types of images<ScrollView><ScrollView><UIScrollView><div>A generic scrolling container that can contain multiple components and views<TextInput><EditText><UITextField><input type="text">Allows the user to enter text

Since React Native does not run in a browser environment but on the device itself, you can’t use CSS to style your components. Instead, React Native provides a StyleSheet API that is similar to CSS. The StyleSheet API is used to define styles for your components by creating a StyleSheet object and passing it to the style prop of a component. You can find an example of how to create a simple React Native app view including how to use the StyleSheet API in the following code snippet:

import React from 'react';
import { Text, View, StyleSheet } from 'react-native';

const App = () => {
  return (
    <View style={styles.container}>
      <Text style={styles.text}>Hello World! 🎉</Text>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  text: {
    fontSize: 20,
  }
});

export default App;

Do you need React Native expertise for your Web App? Drop us an email. We are looking forward to it!

Michael Jaser

Your contact person: Michael Jaser, Co-Founder

Strengths of React Native

React Native is a popular choice for building cross-platform mobile applications. One of the key reasons for this is the extensive ecosystem of packages and libraries available, which simplifies the development process by providing ready-to-use solutions for common tasks. Additionally, the comprehensive and well-maintained documentation as well as community resources ensure that developers can quickly find answers to their questions and follow best practices.

Here are more highlights on why React Native can be a solid choice for your next app development project:

  • Open-source library backed by Meta.
  • Higher efficiency and lower costs, as fewer people are needed for the project.
  • React Native recommends using TypeScript by default.
  • A single codebase for developing mobile and desktop apps.
  • Easy integration with native modules.

Challenges using React Native

There are quite a few challenges when it comes to developing mobile apps with React Native. Most of them stem from the fact that you are developing a mobile application, and not a web application. This means dealing with different screen sizes, varying device capabilities, and different ecosystems. You need to get used to using simulators or emulators to test your app, which can be slow at times. Additionally, deploying and debugging your app can be more challenging than in web development.

Another challenge is the delayed access to new features or APIs introduced in Android or iOS, which are often not immediately available in React Native. However, it is possible to write a library in the native languages and integrate it into the React Native project to utilize these new features right away.

What’s more, React Native provides only the foundation for mobile app development. Developers must manually assemble tools and libraries to create a fully functional app. This is where Expo comes into play, offering a suite of tools to streamline the process.

In which projects to we use React Native?

At Peerigon, we have integrated React Native as a cross-platform technology into our tech stack. In fact, we used it to build our very own voting tool, Konsens, and we’re thrilled with how smoothly everything has gone so far. React Native handles many of the repetitive development tasks, offering robust support and a rich ecosystem that streamlines the process. This allows us to focus on the product and its user experience, rather than dealing with the tedious details of platform-specific APIs or writing the same app twice. Curious to see it in action? Download Konsens today and try it out for yourself!

Konsens

Konsens: Our tool for simplifying decision-making

How can we guarantee democratic co-determination in the company? How can we make our group decisions fairer, more private, more practical? You’ll say: for a team that consists mainly of programmers and web developers, surely there must be a solution to this problem? Well, we developed a voting app. Our co-determination tool Konsens facilitates group decisions, whether in the office or from home. We hosted Konsens as an online app in Germany and made it freely accessible to other companies or individuals.

A strong partner for React Native apps

Our software developers use methods where they make sense. Whether it's helping a start-up with setup or a seamless transfer of existing codebases into React Native: Just ask us!