React Holiday

Anchors Away!

Handling all events in the browser is a compelling drug.

When I first started writing single-page apps, I said “bye bye bye” to my anchors and did everything with buttons. Buttons are great! But linking — via URL — is what makes the web what it is!

The difference between a button and an anchor is nuanced but important. For me, buttons handle verbs and anchors navigate to nouns.

If I want to view a specific pokemon (noun), I need an anchor to that noun’s location: my-pokemon.app/pokemon/bulbasaur.

If I want to create, update, or destroy (verbs) a pokemon, I use a button.

This is where the nuance comes in. These actions (verbs) will eventually navigate to resources (nouns) — updating the url. But they do so by redirecting to a resource URL after the action is complete.

Take it home

Routers are a critical part of any application framework. React doesn’t come with a standard. If you create React apps today, which is your favorite router and why did you pick it?