Pages on pages
Luckily, saner heads prevail and the head product designer (the highest ranked of the five designers now employed by the company) says that they need only three views for the prototype: the login view (done!), the main chat view, and the user profile view.
Still, we clearly need a robust and extensible way to move between different screens in our app. We need a good solid routing solution.
Traditionally, routing has been a question of which HTML/CSS/JavaScript files are served up. You hit the URL at static-site.com and get the main index.html
, then go to static-site.com/resources and get the resources.html
.
In this model, the server gets a request for a certain URL and returns the appropriate files.
Increasingly, however, routing is moving to the client side. In a React world, we only ever serve up our index.html
and bundle.js
. Our JavaScript takes in the URL from the browser and then decides what JSX to render.
Hence the term Single-Page App--our user technically only ever sits...