Chapter 5. Routing and State Management
Every web application, no matter how sophisticated its architecture or how clever its rendering strategy, ultimately boils down to two questions: what is the user looking at, and what data does the application need to show it? The URL answers the first question. State management answers the second.
These two concerns are deceptively simple on their own. Developers learn routing in an afternoon. State management takes a bit longer, mostly because there are many competing libraries and everyone on the internet has a strong opinion about which one you should use. But the real complexity isn’t in routing or state management individually. It’s in the space between them.
The URL is state that lives outside your application. It’s visible in the address bar, shareable, bookmarkable, and indexed by search engines. Some of your application’s state belongs there ike filters, pagination, the selected tab. Some of it absolutely doesn’t. Whether a dropdown is open, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access