Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elm: Is there any url router that works for version 0.17?

Tags:

elm

Is there any elm router that works for version 0.17?

There are several of them that are not compatible with the latest release.

Thank you very much!

like image 933
afcastano Avatar asked May 16 '16 01:05

afcastano


Video Answer


1 Answers

Apparently a router is not needed any more, according to https://github.com/etaque/elm-routing-example

Do we need routers?

I don't think so anymore, at least since Elm 0.17 and port modules, and I say that as the author of elm-transit-router, one of the three main routers for Elm 0.16.

We need packages for route parsing: that is, a way to transform the string representation of the path or hash to our app internal model. There are a few packages for this already: Bogdanp/elm-route and etaque/elm-route-parser (disclaimer: I'm the author). sporto/hop also has parsing tools but it isn't yet migrated to 0.17.

For the rest, Elm is already efficient at the job, it's just a few Msg away!

In this example I added a fancy transition effect to illustrate my point: if you implement routing by yourself, you gain more power for specific behaviours.

Note: browser history handling is done with ports for now, but it will be >easy to upgrade when the Elm bindings will be ready.

like image 120
intrepion Avatar answered Nov 05 '22 16:11

intrepion