Book Image

React Native Cookbook. - Second Edition

By : Daniel Ward
4 (1)
Book Image

React Native Cookbook. - Second Edition

4 (1)
By: Daniel Ward

Overview of this book

If you are a developer looking to create mobile applications with maximized code reusability and minimized cost, React Native is what you need. With this practical guide, you’ll be able to build attractive UIs, tackle common problems in mobile development, and achieve improved performance in mobile environments. This book starts by covering the common techniques for React Native customization and helps you set up your development platforms. Over the course of the book, you’ll work through a wide variety of recipes that help you create, style, and animate your apps with built-in React Native and custom third-party components. You’ll also develop real-world browser-based authentication, build a fully functional audio player, and integrate Google Maps in your apps. This book will help you explore different strategies for working with data, including leveraging the popular Redux library and optimizing your app’s dataflow. You’ll also learn how to write native device functionality for new and existing React Native projects and how app deployment works. By the end of this book, you'll be equipped with tips and tricks to write efficient code and have the skills to build full iOS and Android applications using React Native.
Table of Contents (17 chapters)

Preface

Parts of this book require software that is only available for macOS. While React Native development can be done on a Windows machine, certain aspects, such as running your applications on iOS devices and in the iOS simulator, or editing native code with Xcode, can only be done with a Mac.

There are many ways for a developer to build an app for iOS or Android. React Native stands out as one of the most stable, performant, and developer-friendly options for building hybrid mobile apps. Developing mobile apps with React Native allows developers to build iOS and Android apps in a single code base, with the added ability for code-sharing between the two platforms.

Even better, a developer with experience in building web apps in React will be ahead of the game, since many of the same patterns and conventions are carried over into React Native. If you've had experience of building web apps with React, or another framework based on Model, View, Component (MVC), you'll feel right at home building mobile apps in React Native.

There are currently two widely-used ways to create and develop a React Native app: with pure React Native using the React Native CLI, or with Expo (www.expo.io), which is a comprehensive set of tools, libraries, and services for developing React Native applications. Unless you need access to certain, often more advanced features of React Native, Expo is my recommendation for React Native development. Expo has many features that improve the development experience, such as access to more native functionality via the Expo SDK, a more flexible and friendly CLI, and a browser-based GUI for common dev tasks. This is why all of the recipes in this book that do not require pure React Native are implemented using Expo. For more on the differences between React Native and Expo, check out the React Native development tools section in Chapter 10, App Workflow and Third-Party Plugins.

This book is intended to serve as a go-to reference for solutions to common problems you'll likely face when building a wide variety of apps. Each chapter is presented as a series of step-by-step recipes that each explain how to build a single feature of an overall app.

React Native is an evolving language. At the time of writing, it's still in the 0.5x stage of the development life cycle, so there are some things that will change in the months and years to come. Best practices could morph into stale ideas, or the open source packages highlighted here could fall out of favor. Every recipe in this book has been updated and revised from its counterpart in the first edition, both to account for updates to the development process and to improve clarity. I've done all I could to keep this text as up to date as possible, but technology moves fast, so it's impossible for a book to keep up by itself. The repository for all of the code covered in this book is hosted on GitHub at . If you find anything in the code here that doesn't seem to be working correctly, you can submit an issue. Or, if you've got a better way to do something, consider submitting a pull request!

Any time there's an update to anything in this book, you will be able to find the details and changes in the GitHub repository.

I hope you find this book helpful on your way through the land of React Native. Happy developing!