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 url 1.0.0

Url.Parser Url.Parser - url 1.0.0

Yes, Browser.application.

Here is an small example app GitHub - sporto/elm-example-app: An example Elm single page application

3 Likes

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