Skip to content

Instantly share code, notes, and snippets.

@JoelQ
Created August 10, 2018 15:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoelQ/66e0f6ac6e5faca93ed5e50bdffdd685 to your computer and use it in GitHub Desktop.
Save JoelQ/66e0f6ac6e5faca93ed5e50bdffdd685 to your computer and use it in GitHub Desktop.
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