![Javascript to Elm artwork](https://is5-ssl.mzstatic.com/image/thumb/Podcasts123/v4/ae/06/b5/ae06b52b-64ae-9a7e-1f31-b293a2085da9/mza_3840978457865575010.png/100x100bb.jpg)
28: Ports Multiplying
Javascript to Elm
English - March 08, 2018 11:00 - 31 minutes - 22.6 MB - ★★★★★ - 4 ratingsTechnology elm javascript programming Homepage Download Apple Podcasts Google Podcasts Overcast Castro Pocket Casts RSS feed
Previous Episode: 27: State of Elm
Next Episode: 29: Elm in React Live
We are back to meow notes, adding our onClick event from Elm back to React to route either to a new note, or an existing note by note.id. This is going to require us to poke another hole in our ports, but remember Murphy’s warning, not to treat this like http methods, so lets keep that in mind as we move forward.
Extra Type Alias I had made a type alias Notes = List Note Mostly because the compiler was complaining at one point, and I wasn’t able to see to distill from it that all I needed was some parentheses around List Note to disambiguate it. Tackling the onClick event
List.map (\n -> Listgroup.li [ onClick (routeTo "/notes/" ++ n.noteId) ] [ text n.content ]) notes
that was my first thought, but.. The 1st argument to function `li` is causing a mismatch. - Function `li` is expecting the 1st argument to be: List (Listgroup.ItemOption msg) But it is: List (Html.Attribute a)grrrrrr
List (Html.Attribute msg) But the right side is: Html.Attribute Msg What I finally got Listgroup.button [ Listgroup.attrs