I have a simple Hello World application with one route route without a route or pointer. For routing, I use simple routes instead of jsx sysntax. Again, I use dynamic-router dynamic routing to load the Hello component using webpack. My app.jsx file has the following code .
import React from "react"; import ReactDOM from "react-dom"; import {Router, browserHistory} from "react-router"; import Hello from "./components/Hello"; const routes = [{ path:"/", getComponents(location, callback) { require.ensure([], function (require) { callback(null, require('./components/Hello')) }) } }]; ReactDOM.render( <Router history={browserHistory} routes={routes}/>, document.getElementById("container") );
The Hello.jsx component has the following code
import React from "react"; export default class Hello extends React.Component { render() { return ( <h2>Hello World</h2> ) } }
reactjs webpack react-router
manas
source share