I installed the react-router on my project via run the following code snippet in the command prompt window:
npm install react-router
I found out that react-router installed successfully because there was no error on installing and also the output was:
- [email protected] updated 1 package in 19.53s
Based on a tutorial, I set my Index.js like the following code:
ReactDOM.render((
<Router history = {browserHistory}>
<Route path = "/" component = {App}>
<IndexRoute component = {Home} />
<Route path = "home" component = {Home} />
<Route path = "about" component = {About} />
<Route path = "contact" component = {Contact} />
</Route>
</Router>
), document.getElementById('app'))
Now when I want to compile/build my application, these error occurs:
./src/index.js
Line 14: 'Router' is not defined react/jsx-no-undef
Line 14: 'browserHistory' is not defined no-undef
Line 15: 'Route' is not defined react/jsx-no-undef
Line 16: 'IndexRoute' is not defined react/jsx-no-undef
Line 17: 'Route' is not defined react/jsx-no-undef
Line 18: 'Route' is not defined react/jsx-no-undef
Line 19: 'Route' is not defined react/jsx-no-undef
I know the compiler couldn't find the routing classes, and I have searched for problems like my issue on google and this community, but actually my search result was not helpful. Thank you for your responding.