CHAPTER 5

image

Routing

The URL is an important strength that the Web has over native apps. It was born as simple pointer to a document on a server, but in web applications the best way to think of it is as the representation of the application’s current state. By looking at the URL the user can understand the part of the application where he currently is, but he can also copy it for later use or pass it along.

Implementing Routing the “Naive” Way

To understand how basic routing works as well as the complications that quickly arise in scenarios a little bigger than basic, non-nested navigation, let’s begin by implementing a simple component that, depending ...

Get Pro React now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.