Accepted answer

Use this on top of your javascript:

var Router = ReactRouter.Router;
var Route = ReactRouter.Route;
var IndexRoute = ReactRouter.IndexRoute;
var Link = ReactRouter.Link;
var browserHistory = ReactRouter.browserHistory;

and remove the import statements.

I'm currently using this react-router package:


Here's an example at CodePen: -- it uses no import statements.


Here's a minimal example of how this can be accomplished:

<!DOCTYPE html>
    <meta charset='UTF-8'>
    <script src=''></script>
    <script src=''></script>
    <script src=''></script>
    <script src=''></script>
    <div id='root'></div>
    <script type='text/babel'>
      const Link = ReactRouterDOM.Link,
            Route = ReactRouterDOM.Route;

      const App = props => (
            <li><Link to="/">TO HOME</Link></li>
            <li><Link to="/a">TO A</Link></li>
            <li><Link to="/b">TO B</Link></li>

          <Route path="/" exact component={Home} />
          <Route path="/a" component={A} />
          <Route path="/b" component={B} />

      const Home = props => <h1>HOME</h1>
      const A = props => <h1>A</h1>
      const B = props => <h1>B</h1>

      ReactDOM.render(<App />, document.querySelector('#root'));


for react route v4.0,please read react-router package add two js link on your page:

<script src=""></script>
<script src=""></script>

in js code you can use :

const Router = window.ReactRouterDOM.BrowserRouter;
const Route =  window.ReactRouterDOM.Route;
const Link =  window.ReactRouterDOM.Link;
const Prompt =  window.ReactRouterDOM.Prompt;
const Switch = window.ReactRouterDOM.Switch;
const Redirect = window.ReactRouterDOM.Redirect;

also,can use


to out put all object like:

ReactRouteDOM Objects

Related Query

More Query from same tag