March 2017
Intermediate to advanced
118 pages
2h 1m
English

Next, the router will derive a router state from the URL. To understand how this phase works, we need to learn a bit about how the router matches the URL.
The router goes through the array of routes, one by one, checking if the URL starts with a route's path. Here it will check that /inbox/33/messages/44 starts with :folder. It does, since :folder is what is called a variable segment. It is a parameter where normally you'd expect to find a constant string. Since it is a variable, virtually any string will match it. In our case inbox will match it. So the router will set the folder parameter to inbox, then it will take the children ...
Read now
Unlock full access