React Router Getting started with React Router Installation and Setup


To install React Router, just run the npm command

npm install --save react-router

And you're done. This is literally all you have to do to install react router.

Please Note : react-router is dependent on react, So make sure you install react as well.

To set up:

using an ES6 transpiler, like babel

import { Router, Route, Link } from 'react-router'

not using an ES6 transpiler

var Router = require('react-router').Router
var Route = require('react-router').Route
var Link = require('react-router').Link