I am new to ReactJs. This is my code:
var React = require('react');
var ReactDOM = require('react-dom');
var {Route, Router, IndexRoute, hashHistory} = require('react-router');
var Main = require('Main');
ReactDOM.render(
<Router history={hashHistory}>
<Route path="/" component={Main}></Route>
</Router>, document.getElementById('app'));
and compiling it with webpack. Also I added Main component to my aliases.
The console throws these errors:
I also read these links :
React Router failed prop 'history', is undefined
How do I resolve history is marked required, when value is undefined?
Upgrading React-Router and replacing hashHistory with browserHistory
and many searches around the web, but I couldn't fix this issue. React Router is version 4