October 2019
Intermediate to advanced
358 pages
8h 22m
English
That link function packs a surprising amount of punch into a small package. Phoenix helpers provide a convenient way to drop common HTML structures onto your view. There’s nothing special about them. Helpers are simply Elixir functions. For example, you can call the functions directly in IEx:
| | $ iex -S mix |
| | iex> Phoenix.HTML.Link.link("Home", to: "/") |
| | {:safe, [60, "a", [[32, "href", 61, 34, "/", 34]], |
| | 62, "Home", 60, 47, "a", 62]} |
The return value might look a little odd. We received a tuple with :safe, followed by an unusual looking list of values. This list is known as an I/O list. I/O lists are simply lists of values which allow data to be efficiently used for I/O, such as writing values to a socket. ...
Read now
Unlock full access