O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up a boilerplate project

Using the React Native command-line tools, I created a project titled AdditionalComponents. In it, the structure is a lot more simplified than our previous projects.

In each platform-specific index file at the root of the project, it imports an App component from our app folder and registers it to AppRegistry:

// AdditionalComponents/index.ios.js 

import App from './app'; 
import { AppRegistry } from 'react-native'; 
AppRegistry.registerComponent('AdditionalComponents', () => App); 

We will be using the index.js file found in the app folder to contain the code for the examples that we'll be building.

At the end of this step, we have an index.js file:

 // AdditionalComponents/app/index.js import React, { Component ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required