reactjs / react-router-tutorial

5.52k stars 1.75k forks source link

'react-router' does not contain an export named 'IndexRoute' #331

Open jcubic opened 6 years ago

jcubic commented 6 years ago

I'm using CreateReactApp and when I use:

import { Router, Route, hashHistory, IndexRoute } from 'react-router';

I've got error:

'react-router' does not contain an export named 'IndexRoute'

Does the api changed and tutorial is out of date?

HansAndreManfredson commented 6 years ago

You can write instead of IndexRoute the following: <Route path="/" component={App} >

PhillipMwaniki commented 6 years ago

@anklaa That will give a warning that the child routes are not going to be rendered.

WilliamShoww commented 6 years ago

'react-router' does not contain an export named 'Link'. So what's instead of Link?

MariuszWojcikDeveloper commented 6 years ago

@WilliamShoww I believe Link was moved here: import {Link} from 'react-router-dom';

Salar-Suliman commented 6 years ago

There is no browserHistory export in v4. If you're using v2/3, then you just need to install the correct version (npm install react-router@3). If you are using v4, you should read this section of the migration guide.

skjaiswal1991 commented 5 years ago

please try to user Dom. import { Router, Route, Link, browserHistory, IndexRoute } from 'react-router-dom';