

There isn’t much else that needs to be done on the client-side to match your server-side react-router routes. All your routing needs are now covered by routes.js.īut, wait! What about client-side routing to match? You can nest your routes as deep as you need to, and you can mix in as many components as needed too. React’s react-router was modeled after the often-praised Ember router. It’s very straightforward and subtly powerful. Import App from './components/app' var app = express() Īpp.engine( 'html', hbs('s. The Express app.js module we built in the last article looks something like this. Implementing it yourself might sound tempting at first, but react-router makes it easy to expand the already-universal app we have with routing capabilities without having to do much different things in either the server or the browser. When it comes to routing in your React app, you could implement it yourself by hand or you could use react-router. One thing there’s to like about React for sure is that it’s only the V in V* (View, Whatever). Today we’ll add routing capabilities to the application so that it isn’t literally a “single-page app” anymore.

Yesterday, we learned about how to set up a build process for an universal ES6 React app using Babel, and how to have that React app render “universally” – on both the server-side and the client-side.
