React Router (ES3)
raw JSON → 2.6.1-rc0 verified Fri May 01 auth: no javascript
A complete routing library for React that keeps your UI in sync with the URL. Version 2.6.1-rc0 (JS-only release, no TypeScript types). Provides simple API with features like lazy code loading, dynamic route matching, and location transition handling. This package is an ES3-compatible fork of react-router v2, targeting older environments (e.g., IE8). Always use the official react-router package for modern development.
Common errors
error Cannot find module 'react-router-es3' ↓
cause Package not installed or module name misspelled.
fix
Run 'npm install react-router-es3' and ensure import path is correct.
error 'React' is not defined ↓
cause Missing React import.
fix
Add 'import React from 'react';' at the top of your file.
error TypeError: Cannot read property 'path' of undefined ↓
cause Route component not rendered correctly; missing parent Route.
fix
Ensure all routes are children of a Router component with proper nesting.
Warnings
breaking This is an ES3-compatible fork of react-router v2. It is not the official react-router package. ↓
fix Use the official react-router package for modern development (v3+).
gotcha No TypeScript type definitions. Importing from 'react-router-es3' will cause TS errors. ↓
fix Install @types/react-router for v2 types, but they may not match perfectly.
breaking Version 2.6.1-rc0 is a release candidate; API may change before stable. ↓
fix Use a stable version if available.
Install
npm install react-router-es3 yarn add react-router-es3 pnpm add react-router-es3 Imports
- Router wrong
import Router from 'react-router-es3'correctimport { Router } from 'react-router-es3' - Route wrong
const Route = require('react-router-es3/Route')correctimport { Route } from 'react-router-es3' - browserHistory wrong
import { browserHistory } from 'react-router'correctimport { browserHistory } from 'react-router-es3'
Quickstart
import React from 'react';
import { render } from 'react-dom';
import { Router, Route, Link, browserHistory } from 'react-router-es3';
const Home = () => <h1>Home</h1>;
const About = () => <h1>About</h1>;
render(
<Router history={browserHistory}>
<Route path="/" component={Home} />
<Route path="/about" component={About} />
</Router>,
document.getElementById('root')
);