dennybritz/neal-sample

Adding another route issue

lusa opened this issue · 2 comments

lusa commented

Hello, awesome library! I'm trying to add another page and failing to match a route except for the index route. My issue is the described here: (Cannot GET *) react-webpack-generators/generator-react-webpack#141

For example below, I should hit my restaurant component when I go to localhost:8080/restaurant

  <Router history={history}>
    <Route path="/" component={SampleApp} history={history}>
      <IndexRoute name="home" component={SamplePage}/>
      <Route path="restaurant" component={Restaurant}/>
      <Route path="*" component={SamplePage}/>
    </Route>
  </Router>

I think adding an extra page in your app.jsx would help clarify how to do this for other consumers of this sample library. Side note: How has this approach been working for landing pages? I am very excited to start using React, just hoping it doesn't overcomplicate development for simple things.

Thanks for filing this. I'll take a look at this over the holidays, will get back to you soon.

Okay, it seems like the problem was the the webpack-dev-server wasn't picking up the changes due to a misconfiguration. I fixed that in d750785 and it should work now if you test with npm server. Your code looks fine to me! Let me know if you still run into problems and I'll re-open this.

Yeah, react isn't really meant for simple landing pages, but having re-usable components just makes it really easy to build them :)