How to upgrade from the 0.18 'Navigation' to the 0.19 'Browser'?

In Elm 0.18, we have the elm-lang/navigation package.
In my current Elm-app, I’ve used the setup explained in elm-navigation-example to use the Navigation package to handle routing.

However, upgrading this to the 0.19 approach is not straightforward, so now I have some questions:

  • The Navigation.Location type is gone, what to use instead? Browser has both Key and UrlRequest, so I don’t think there is a 1:1 mapping.
  • I used to parse the URL using the UrlParser that the package exposed, but this module no longer exists. What to use instead?
  • Before, my Main.main implementation was a Navigation.program. Do I now use Browser.application or something else?

Help is greatly appreciated!

These pages on the new guide cover these exact topics:
https://guide.elm-lang.org/webapps/navigation.html
https://guide.elm-lang.org/webapps/url_parsing.html

1 Like

This is now Url.Url from https://package.elm-lang.org/packages/elm/url/latest/

Url.Parser https://package.elm-lang.org/packages/elm/url/latest/Url-Parser

Yes, Browser.application.

Here is an small example app https://github.com/sporto/elm-tutorial-app

3 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.