I am using react-router with react js and i following their documentation but facing this error
while compiling it shows the error,
TypeError: _this.
This should be done in the component that is being routed to. In this case, it is App component. Therefore, in App.js, import "createBrowserHistory" and do it as follows:
import React, { Component } from 'react';
import './App.css';
import { createBrowserHistory } from "history";
class App extends Component {
constructor(props){
super(props);
this.history = createBrowserHistory();;
this.state = {
headerText: "Props from Header.",
contentText: "Props from content."
};
}
render() {
return (
);
}
}
export default App;