# "Route reuse" + looking for general advice

**URL:** https://discourse.elm-lang.org/t/route-reuse-looking-for-general-advice/7826
**Category:** Learn
**Created:** [October 16, 2021, 9:33am UTC](https://discourse.elm-lang.org/t/route-reuse-looking-for-general-advice/7826 "2021-10-16T09:33:56Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![jerith](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/jerith/32/114_2.png) [@jerith](https://discourse.elm-lang.org/u/jerith)
#### Post date: [October 21, 2021, 1:28am UTC](https://discourse.elm-lang.org/t/route-reuse-looking-for-general-advice/7826/5 "2021-10-21T01:28:18Z")

</div>

I’ve found the `onUrlRequest` / `onUrlChange` bifurcation in [`Browser.application`](https://package.elm-lang.org/packages/elm/browser/latest/Browser#application) to be really tedious to work with. It’s better than it was in 0.18, but still doesn’t feel natural to me. See more discussion in this thread:

> [@Understanding the "double update" behavior of Browser.application](https://discourse.elm-lang.org/t/understanding-the-double-update-behavior-of-browser-application/2963/1):
>
> Hi all, I’m working upgrading to Elm 0.19. Our main was using Navigation.programWithFlags and I’ve shifted to Browser.application. In my efforts to understand what was needed, I was reviewing experience reports like [@jerith 's update experience report.](https://discourse.elm-lang.org/t/a-0-19-update-experience-report/2593). I wanted to understand a line in here: elm-route-url does seem to still be necessary: Browser.application still has a “double-update problem”. I have realized that I don’t fully understand the impact of switching directly to Browser.applica…

Since that thread, I’ve completed [updating `elm-route-url` to 0.19](https://github.com/rgrempel/elm-route-url/pull/38) (but it hasn’t been merged yet).

I’ve also built upon that to create a feature I call “anchor management”. I’ve been using it in my app for a while now and really like it.

The basic idea is that your `view` function gets a `msg -> ... -> Html msg` helper function that it can use to make `<a/>` elements that correspond to a `msg` in your app. These special `<a/>` elements that it creates interact with your `update` function much more cleanly, their target URLs are automatically generated using the other functions you’ve already provided to `RouteUrl`, etc. No more choosing the lesser evil between `a href` and `div onClick`. 🙂

Unfortunately I haven’t had time to write documentation for it, so you’ll have to see what more you can gather from the [code changes](https://github.com/jerith666/elm-route-url/commit/01f22f1164c1ef71a07ed7ab48c6f051f354d7cd) and my [sandbox test code](https://github.com/jerith666/elbum/blob/dev/src/client/src/Sandbox/AnchorTest.elm).

---

_[View the full topic](https://discourse.elm-lang.org/t/route-reuse-looking-for-general-advice/7826)._
