How to do it...

  1. At this point, our app has no references to React Native, so we'll start by installing it. In the app's root folder, in the Terminal, install React Native from the command line using yarn:
yarn add react-native

Alternatively, you can use npm:

 npm install react-native --save
  1. We'll also need a Node.js script for starting the React Native app. Let's open package.json and add the following property as a member of the scripts object:
 "start": "node node_modules/react-native/local-cli/cli.js start"
  1. We only need a very simple React Native app for this recipe. Let's create an index.android.js file with the following boilerplate app:
import React, { Component } from 'react';import { AppRegistry, StyleSheet, View, Text } from ...

Get React Native Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.