I am doing this Router tutorial.
My App.jsx file:
import React from \'react\';
import ReactDOM from \'react-dom\';
import { Router, Route, Link, browserH
You need to import ReactDOM
in Main.js
instead of App.jsx
, as Main
is where you are using ReactDOM
to render.
Also need to import React
in all files that use JSX.
Finally, also put react-router
imports into Main
, too.
The way imports work is, you import things you need, in places they're needed. It's not enough to import them once in one file and use in others.
Change Main.js
to look like
import ReactDOM from 'react-dom'
import React from 'react'
import { Router, Route, browserHistory, IndexRoute } from 'react-router'
ReactDOM.render((
), document.getElementById('app'))