Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Refactoring magic strings in Elm views
view : Model -> Html Msg
view model =
div []
[ div [ class "icon" ] [ span [class "icon-profile" ] [] ]
, div [ class "icon" ] [ span [ class "icon-clock" ] [] ]
]
-- REFACTOR TO
view : Model -> Html Msg
view model =
div []
[ icon "profile"
, icon "clock"
]
-- REFACTOR TO
view : Model -> Html Msg
view model =
div []
[ Icon.profile
, Icon.clock
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment