52: Gonna Make It - JSToElm
All Episodes

52: Gonna Make It

We are coming down to the wire to get the rest of our app from React to Elm. Router has been a huge hang up for us this last week. Might be through the tough parts. Let's find out. Elm-Conf. 1 day, 1 track pre-conference to Strange Loop in St. Louis. I will be there. If you haven't bought a ticket, or flight your window is, well, pretty much closed. Usually I put a link to the site to register, but at this point, your new goal is to watch all of last years videos in anticipation [Elm-conf 2017 Videos ](https://www.youtube.com/channel/UCOpGiN9AkczVjlpGDaBwQrQ/videos) A huge thank you to everyone at Elm-conf for all your hard work.

Getting Through the routing

  • Elm wasn’t updating when the URL changed.

    • Probably bc we weren’t telling elm, only the react router. D’oh
  • Elm Navigation helper function newUrl and modifyUrl

    • newUrl takes a string and returns a Cmd
    • only changes url currently on, does not all to the browser history, ?
    • man, gotta learn a little more about browser API’s. So much of my time up til now has been reliant on the JS Framework to abstract those away. Not a bad thing, just never learned the core functionality that I was using.
  • New Note and Existing note both launch to the right page!!! We are, in a funny way, right back where we started.
  • Man we are in the deeps of Elm. This is fun.
  • Getting note data by id

    • Outing going data with note id as part of the request
    • Done lots of these
    • We’ll need to request it when the URL matches the “note” rough
    • Ah, where to make this request?
    • Probably best in the update where we are getting the UrlChange ? yeah.
    • We can pattern match on if it’s the ‘Note’ route and then call that cmd there ? cool.
    • Then some incoming data to populate the view.
    • Type trickery
    • how do you take a type that takes a variable type of arguments
    • collapse all those parameters

Resources

Follow

Published 25 Sep 2018

A show about learning Elm, Functional Programing, and generally leveling up as a JS developer.
JavaScript To Elm on Twitter