react-webpack-generators / generator-react-webpack

Yeoman generator for ReactJS and Webpack
http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/
MIT License
2.88k stars 355 forks source link

Children not loading before hot reload was triggered #247

Closed mmintel closed 8 years ago

mmintel commented 8 years ago

hi there,

first off: nice project! thanks!

I have only one problem: my contents in {this.props.children} are not loaded initially. First when I make a change to a file to trigger a hot reload I will see the contents.

My first thought was that it had to do with react-router but every bug related to that was fixed before.

That's the code of my main.jsx:

export default class AppComponent extends React.Component {
  render() {
    return (
        <main id="page">
          {this.props.children}
        </main>
    );
  }
}

ReactDOM.render(<AppComponent />, document.getElementById('app'));

ReactDOM.render((
  <Router history={browserHistory}>
    <Route path="/" component={AppComponent}>
      <IndexRoute component={Home} />
      <Route path="*" component={NoMatch}/>
    </Route>
  </Router>
), document.querySelector('#app'));

Do you have any idea?

mmintel commented 8 years ago

just found out by myself: I placed the Router in Main.js but it has to be placed in index.js