Create React App

Create React App

  • Getting started
  • Help
  • GitHub

›Building your App

Welcome

  • About the docs

Getting Started

  • Getting started
  • Folder structure
  • Available scripts
  • Browsers and Features
  • Updating to New Releases

Development

  • Editor setup
  • Developing Components in Isolation
  • Analyzing bundle size
  • HTTPS in Development

Styles and Assets

  • Adding stylesheets
  • Adding CSS Modules
  • Adding Sass Stylesheets
  • Post-Processing CSS
  • Adding Images, Fonts, and Files
  • Using the public Folder
  • Code Splitting

Building your App

  • Installing a Dependency
  • Importing a Component
  • Using Global Variables
  • Adding Bootstrap
  • Adding Flow
  • Adding Relay
  • Adding a Router
  • Environment Variables
  • Making a Progressive Web App

Back-End Integration

  • Proxying in development
  • Fetching Data
  • Integrating with an API
  • Title & Meta Tags

Testing

  • Running tests
  • Debugging tests

Deployment

  • Publishing to npm
  • Deployment

Advanced Usage

  • Can I Use Decorators?
  • Pre-Rendering Static HTML
  • Advanced Configuration
  • Alternatives to Ejecting

Support

  • Troubleshooting
  • Feedback

Adding a Router

Create React App doesn't prescribe a specific routing solution, but React Router is the most popular one.

To add it, run:

npm install --save react-router-dom

Alternatively you may use yarn:

yarn add react-router-dom

To try it, delete all the code in src/App.js and replace it with any of the examples on its website. The Basic Example is a good place to get started.

Note that you may need to configure your production server to support client-side routing before deploying your app.

← PreviousNext →
Create React App
Docs
Getting StartedDocumentation
Community
Stack OverflowSpectrumTwitter
More
GitHubStar
Facebook Open Source
Copyright © 2018 Facebook Inc.