I'm trying to create a React app, but I'm having a problem: when I try to load the main page no errors are thrown, but nothing is shown on the page.
The entry point of the app is main.js
, which has this in the render
method:
React.render((
<Router history={history}>
<Route component={RootComponent}>
<Route path="/page1" component={Page1}></Route>
<Route path="/page2" component={Page2}></Route>
</Route>
</Router>
), document.body);
The render
method of RootComponent.js
looks like this:
render() {
return (
<div className="navContainer">
<Menu onMenuChange={::this._onMenuChange} ref="slidemenu" alignment="left">
<MenuItem hash="/page1">Dash Board</MenuItem>
<MenuItem hash="/page2">Create Deal</MenuItem>
</Menu>
<div className={this.state.expand ? 'slidebody' : 'shrinkbody'}>
<span className="menuIcon" onClick={this.showLeft}>☰</span>
{this.props.children}
</div>
</div>
);
}
The rest of the components are simple components. As I mentioned, there are no errors, but the app shows nothing. This is what is actually rendered in the browser:
<body>
<noscript data-reactid=".0"></noscript>
</body>
I'm using "react": "^0.13.3" and "react-router": "^1.0.0-beta3".
Why is nothing shown on the page? How can I correct this?