Olá tudo bem?
Estou com problemas para implementar o react router. Segue o erro:
TypeError: Cannot read property 'location' of undefined
Código:
index.js: import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; import { Router, Route } from 'react-router';
ReactDOM.render( ( ), document.getElementById('root') );
// If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: http://bit.ly/CRA-PWA serviceWorker.unregister();
package.json:
{ "name": "cdm-admin", "version": "0.1.0", "private": true, "dependencies": { "jquery": "^3.3.1", "pubsub-js": "^1.7.0", "react": "^16.6.1", "react-dom": "^16.6.1", "react-router": "^4.3.1", "react-scripts": "2.1.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] }
Se alguém puder me ajudar eu agradeço muito!
Desde já agradeço!