Javascript to Elm
51: Elm Routing (Maybe)
- Author: Vários
- Narrator: Vários
- Publisher: Podcast
- Duration: 0:26:46
- More information
Informações:
Synopsis
Getting over the hump for Routing We tired several attempts to define or explain routing in Elm, with varying degrees of success, mostly failing. Routing must be a pure function, since it’s not in the update function of our Elm App, it can not be a side effect Knowing that, the url coming in from the browser’s API is going to always be a string, then think, what kind of data do we want the route function to return to us? HTML? Here in lies my struggle. I know the input, but have not expressly figured out what the output needs to be. You can get this sense by my attempts to explain the route type signature several times in the previous episode. Use the Url parser and map We need a couple things Location is a record Extract Route a function that take the type Location and returns a Type of Route case (Url.parsePath matchRoute location) of parsePath takes matchRoute and that function takes a Location and returns us a glorious Route Match Route Need to Figure out this case statement matchRoute takes a functio