Ao fazer a aula sobre Routers, fiz conforme o instrutor falou (inclusive coloquei o react-router na mesma versão) e está retornando esse erro:
TypeError: Cannot read property 'location' of undefined
Meu index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import { Router, Route } from 'react-router';
ReactDOM.render(
(<Router>
<Route path="/" component={App}/>
<Route path="/autor"/>
<Route path="/livro"/>
</Router>),
document.getElementById('root')
);
registerServiceWorker();
Segue o meu package.json
:
{
"name": "cdc-admin",
"version": "0.1.0",
"private": true,
"dependencies": {
"jquery": "^3.2.1",
"pubsub-js": "^1.5.7",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router": "^2.8.0",
"react-scripts": "1.0.17"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}