react-router-tutorial icon indicating copy to clipboard operation
react-router-tutorial copied to clipboard

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

Open jcubic opened this issue 7 years ago • 6 comments

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?

jcubic avatar Jan 06 '18 10:01 jcubic

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

HansAndreManfredson avatar Jan 11 '18 18:01 HansAndreManfredson

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

PhillipMwaniki avatar Jan 15 '18 11:01 PhillipMwaniki

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

WilliamShoww avatar Jun 28 '18 07:06 WilliamShoww

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

MariuszWojcikDeveloper avatar Jul 25 '18 21:07 MariuszWojcikDeveloper

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.

Salar-Suliman avatar Aug 08 '18 14:08 Salar-Suliman

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

skjaiswal1991 avatar Jul 12 '19 13:07 skjaiswal1991