Menu
Create React App LogoCreate React App
DocsHelpGitHub
Create React App LogoCreate React App
  • Docs
  • Help
  • GitHub
  • Welcome
    • About Docs
  • Getting Started
    • Getting Started
    • Folder Structure
    • Available Scripts
    • Supported 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
    • Adding CSS Reset
    • Post-Processing CSS
    • Adding Images, Fonts, and Files
    • Loading .graphql Files
    • Using the Public Folder
    • Code Splitting
  • Building your App
    • Installing a Dependency
    • Importing a Component
    • Using Global Variables
    • Adding Bootstrap
    • Adding Flow
    • Adding TypeScript
    • Adding Relay
    • Adding a Router
    • Environment Variables
    • Making a Progressive Web App
    • Measuring Performance
    • Creating a Production Build
  • Testing
    • Running Tests
    • Debugging Tests
  • Back-End Integration
    • Proxying in Development
    • Fetching Data
    • Integrating with an API
    • Title & Meta Tags
  • Deployment
    • Deployment
  • Advanced Usage
    • Custom Templates
    • Can I Use Decorators?
    • Pre-Rendering Static HTML
    • Advanced Configuration
    • Alternatives to Ejecting
  • Support
    • Troubleshooting

Installing a Dependency

The generated project includes React and ReactDOM as dependencies. It also includes a set of scripts used by Create React App as a development dependency. You may install other dependencies (for example, React Router) with npm:

npm install --save react-router-dom

Alternatively you may use yarn:

yarn add react-router-dom

This works for any library, not only react-router-dom.

Edit this page
Last updated on 2019-10-24 by Ian Sutherland
Previous

« Code Splitting

Next

Importing a Component »

Docs

  • Get Started
  • Learn React

Community

  • Stack Overflow
  • GitHub Discussions
  • Twitter
  • Contributor Covenant

Social

  • GitHub
Facebook Open Source Logo
Copyright © 2020 Facebook, Inc.