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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.