Open nagarajach opened 6 years ago
After I add import statement of Router into index.js like below import { Router, browserHistory} from 'react-router'; getting this error
@nagarajach perhaps this is addressed in lectures beyond the last one that i watched, but what i found is that you cannot use a <Link>
outside of a <Router>
. I changed my app.js
to the following, installed the necessary npm packages, and got the app to work.
import React, { Component } from 'react';
import Header from './header';
import { Router } from 'react-router-dom';
import createBrowserHistory from 'history/createBrowserHistory'
const customHistory = createBrowserHistory()
export default class App extends Component {
render() {
return (
<Router history={customHistory}>
<div>
<Header />
</div>
</Router>
);
}
}
@Eric Thanks for your Quick reply.
I got fixed this error with installed latest version react-router-dom@4.2.2 instead of react-router-dom@4.1.1 as you mentioned in the latest video Lesson-114.
Thank You So Much :)
Hello StephenGrider,
After added Routes to Router getting this below error. Could you please help me to get out of this.
Uncaught TypeError: Cannot read property 'func' of undefined at Object.exports.esModule (bundle.js:25555) at webpack_require (bundle.js:20) at Object. (bundle.js:22611)
at Object.exports. esModule (bundle.js:22775)
at webpack_require (bundle.js:20)
at Object.exports.esModule (bundle.js:22447)
at __webpack_require (bundle.js:20)
at Object. (bundle.js:68)
at __webpack_require__ (bundle.js:20)
at Object. (bundle.js:47)
Thank You