Skip to content

Commit

Permalink
Mention Phoenix usage
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Aug 9, 2023
1 parent 1a79e78 commit 562a92b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/phoenix_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defmodule Phoenix.Component do
[the `~H` sigil](`sigil_H/2`):
defmodule MyComponent do
# In Phoenix apps, the line is typically: use MyAppWeb, :html
use Phoenix.Component
def greet(assigns) do
Expand Down Expand Up @@ -135,6 +136,7 @@ defmodule Phoenix.Component do
`<Component.heading>` requires a `title`, but *does not* require a `name`.
defmodule Components do
# In Phoenix apps, the line is typically: use MyAppWeb, :html
use Phoenix.Component
attr :title, :string, required: true
Expand Down
4 changes: 2 additions & 2 deletions lib/phoenix_live_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ defmodule Phoenix.LiveComponent do
The smallest LiveComponent only needs to define a `c:render/1` function:
defmodule HeroComponent do
# If you generated an app with mix phx.new --live,
# the line below would be: use MyAppWeb, :live_component
# In Phoenix apps, the line is typically: use MyAppWeb, :live_component
use Phoenix.LiveComponent
def render(assigns) do
Expand Down Expand Up @@ -65,6 +64,7 @@ defmodule Phoenix.LiveComponent do
a DOM ID, it is your responsibility to do so when rendering:
defmodule UserComponent do
# In Phoenix apps, the line is typically: use MyAppWeb, :live_component
use Phoenix.LiveComponent
def render(assigns) do
Expand Down
3 changes: 2 additions & 1 deletion lib/phoenix_live_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ defmodule Phoenix.LiveView do
`c:render/1`:
defmodule MyAppWeb.ThermostatLive do
# In Phoenix v1.6+ apps, the line is typically: use MyAppWeb, :live_view
# In Phoenix apps, the line is typically: use MyAppWeb, :live_view
use Phoenix.LiveView
def render(assigns) do
Expand Down Expand Up @@ -139,6 +139,7 @@ defmodule Phoenix.LiveView do
with a timer:
defmodule DemoWeb.ThermostatLive do
# In Phoenix apps, the line is typically: use MyAppWeb, :live_view
use Phoenix.LiveView
...
Expand Down

0 comments on commit 562a92b

Please sign in to comment.