the alias goes in the view module (#107)
This commit is contained in:
parent
8377a04ab3
commit
6fe46cbb49
|
@ -88,8 +88,10 @@ end
|
|||
And we could use the component like so
|
||||
|
||||
```elixir
|
||||
# lib/my_app_web/views/page_view.ex
|
||||
alias MyAppWeb.Components.Flex
|
||||
|
||||
# lib/my_app_web/templates/page/index.html.exs
|
||||
c Flex, class: "justify-between items-center", id: "arnold" do
|
||||
div do: "Hi"
|
||||
div do: "I'm"
|
||||
|
|
|
@ -44,8 +44,10 @@ defmodule Temple.Component do
|
|||
Since components are just modules, if you alias your module, you can use them more ergonomically.
|
||||
|
||||
```
|
||||
# lib/my_app_web/views/page_view.ex
|
||||
alias MyAppWeb.Components.Flex
|
||||
|
||||
# lib/my_app_web/templates/page/index.html.exs
|
||||
c Flex, class: "justify-between items center" do
|
||||
for item <- items do
|
||||
div class: "p-4" do
|
||||
|
|
Reference in a new issue