Book Image

React Native - Building Mobile Apps with JavaScript

By : Vladimir Novick
Book Image

React Native - Building Mobile Apps with JavaScript

By: Vladimir Novick

Overview of this book

<p>The emergence of React Native has made creating mobile apps in JavaScript easier for developers. This book introduces you to the React Native framework and the mobile apps development process. It starts with how React Native fits into the world of hybrid apps, and why it’s a popular framework. You’ll learn how React Native works under the hood--compiling JavaScript to Native code to bridge JavaScript and native apps. Also, you’ll learn how to write React Native components and use the ReactJS way of structuring your app. Understand how to use the industry standard Redux architecture as well as MobX--a newly emerging approach for state management--making your apps more robust and scalable.</p> <p>The mobile native world can be intimidating, with lots of platform-specific APIs. In this book, you’ll learn about the most important APIs with help of the real-world examples. You’ll also learn about the community packages that can help speed up your development. The book explains how to use these packages with JavaScript code, include native modules in your application, and write the modules yourself. Throughout the book, you will see examples of WhatsApp, Instagram, and YouTube apps and learn how to recreate them. You’ll also learn debugging and testing techniques, authentication, dealing with real data, and much more.</p> <p>At the end we will walk through design to production process of Twitter app clone and will explain application release process to App Store and Play Store</p>
Table of Contents (13 chapters)

Preface

The world of web development is diverse and complicated. New technologies are introduced each year, creating competition between various libraries and frameworks for their place under the sun. Some of these technologies have emerged as web development community answers to problems introduced by constantly evolving user needs. Some were introduced by big corporations, such as Facebook or Google.

For React Native, it all started as an internal hackathon project between the walls of Facebook offices, and since then, it has grown to become one of the most popular frameworks. React Native did something that web developers had tried to do for several years preceding the hackathon--writing mobile apps in JavaScript. There were several ways to write mobile apps, but all of them tackled the idea of hybrid apps.

The main idea was to write apps in HTML, JavaScript, and CSS, and put them inside a thin native container, which would be responsible for rendering all elements. This was all about one code base written using web technologies and rendered on both iOS and Android. Many companies used this idea in production apps, but soon, everyone who wrote mobile hybrid apps figured out that the performance difference was noticeable and multiple bugs led to frustration among web developers trying to break into the mobile development world.

React Native had a different idea in mind. Its idea was to use techniques used in the React library, which came a few years before React Native, and create modular components using JavaScript, but without HTML or CSS involved. React Native uses an internal mechanism to transform JavaScript to native modules. With it, we are dealing with real native apps and not hybrid ones. Performance-wise, apps became identical to native ones, even for complex animations and interactions. React Native also wraps lots of iOS and Android-core APIs and provides a simple bridging API to wrap your own modules or even integrate React Native app inside your existing app.

This book will start by explaining the difference between hybrid apps and React Native and why it's one of the most popular frameworks, and looks like it's going to be the future of mobile apps. It will explain how React Native works under the hood--how JavaScript is compiled to native modules, and how this bridge is architected. After understanding the basic ideas and the architecture of React Native, the book will follow with software installation and setting up a React Native project. It will cover different aspects of the setup for iOS and Android, as well as community solutions and tooling to make the app development experience better.

Then, the book will overview the basic React concepts used in React Native. It will ensure that readers feel comfortable with JSX syntax and understand what it represents. Following these introductory sections, the book will dive deeper into explaining every single React Native component, API, and technique in real-world examples such as WhatsApp, Instagram, and YouTube. It will teach you how to set up your animations, authenticate your app with Firebase or an external server, manage your application state with the best state management libraries such as Redux and MobX, build complex navigation systems in your app, test and debug your applications using built-in as well as community-written tools. The book will not only focus on React Native, but will introduce readers to the whole ecosystem of useful npm packages that can be used in React Native. It will cover how to properly link such packages with native application code and even write your own native code in Java or Objective C to be available inside JavaScript. At the end of the book, all this knowledge will be summarized by creating a major part of Twitter application--pulling actual Twitter data. In the final chapter of the book, readers will also learn how to release their app to App Store or Play Store, and learn about the tools available to speed up the release process.

This book targets JavaScript developers who want to learn how to create native mobile apps using React Native. The reader must have basic JavaScript knowledge, preferably of the latest version of JavaScript--ES2015. If the reader lacks such knowledge, it's advised to walk through a fast tutorial available at https://babeljs.io/learn-es2015/.