sahat / megaboilerplate

Handcrafted starter projects, optimized for simplicity and ease of use.
MIT License
3.83k stars 257 forks source link

Can't add new component and configure new rout (React) #185

Open quangnd opened 7 years ago

quangnd commented 7 years ago

Hey everybody.

I'm using React megaboiler plate (with Redux).

I added a Component name CoursePage.js into Components folder. This component is quite simple, its only render() a

.

And at routes.js, I also imported new component and added new route:

But after run server, request to http://localhost:3000/courses, web's always display 404 - Not Found.

What's wrong with my approach?

sara-gudeman commented 7 years ago

Could you put in a code snippet?

real-ashwin commented 7 years ago

I have the same issue. I also see this in the console.

Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
 (client) " data-reactid="1"><div data-reactid="2"
 (server) " data-reactid="1"><nav class="navbar na

To reproduce,

add a new route to routes.js

import NewRouteTest from './components/NewRouteTest';
<Route path="/newroute" component={NewRouteTest} onLeave={clearMessages}/>
class NewRouteTest extends React.Component {

  render() {
    return (
      <div className="container">
        <div>Enter text here</div>
      </div>
    );
  }
}

export default NewRouteTest;