diff --git a/guides/components.md b/guides/components.md index 9e9e59a3e5..e6431b9b90 100644 --- a/guides/components.md +++ b/guides/components.md @@ -52,7 +52,7 @@ defmodule HelloWeb.HelloHTML do end ``` -We declared the attributes we accept via `attr` provided by `Phoenix.Component`, then we defined our `greet/1` function which returns the HEEx template. +We declared the attributes we accept via `attr` provided by `Phoenix.Component`, then we defined our `greet/1` function which returns the HEEx template. Next we need to update `show.html.heex`: @@ -62,9 +62,9 @@ Next we need to update `show.html.heex`: ``` -When we reload `http://localhost:4000/hello/Frank`, we should see the same content as before. +When we reload `http://localhost:4000/hello/Frank`, we should see the same content as before. -Since templates are embedded inside the `HelloHTML` module, we were able to invoke the view function simply as `<.greet messenger="..." />`. +Since templates are embedded inside the `HelloHTML` module, we were able to invoke the view function simply as `<.greet messenger="..." />`. If the component was defined elsewhere, we can also type ``. @@ -225,7 +225,7 @@ When we load the page, we should be rendering the admin layout without the heade At this point, you may be wondering, why does Phoenix have two layouts? -First of all, it gives us flexibility. In practice, we will hardly have multiple root layouts, as they often contain only HTML headers. This allows us to focus on different application layouts with only the parts that changes between them. Second of all, Phoenix ships with a feature called LiveView, which allows us to build rich and real-time user experiences with server-rendered HTML. LiveView is capable of dynamically changing the contents of the page, but it only ever changes the app layout, never the root layout. We will learn about LiveView in future guides. +First of all, it gives us flexibility. In practice, we will hardly have multiple root layouts, as they often contain only HTML headers. This allows us to focus on different application layouts with only the parts that changes between them. Second of all, Phoenix ships with a feature called LiveView, which allows us to build rich and real-time user experiences with server-rendered HTML. LiveView is capable of dynamically changing the contents of the page, but it only ever changes the app layout, never the root layout. Check out [the LiveView documentation](https://hexdocs.pm/phoenix_live_view) to learn more. ## CoreComponents diff --git a/guides/real_time/presence.md b/guides/real_time/presence.md index 2686962111..106ea41775 100644 --- a/guides/real_time/presence.md +++ b/guides/real_time/presence.md @@ -132,7 +132,7 @@ With token authentication, you should access `socket.assigns.user_id`, set in `U ## Usage With LiveView -Whilst Phoenix does ship with a JavaScript API for dealing with presence, it is also possible to extend the `HelloWeb.Presence` module to support LiveView. +Whilst Phoenix does ship with a JavaScript API for dealing with presence, it is also possible to extend the `HelloWeb.Presence` module to support [LiveView](https://hexdocs.pm/phoenix_live_view). One thing to keep in mind when dealing with LiveView, is that each LiveView is a stateful process, so if we keep the presence state in the LiveView, each LiveView process will contain the full list of online users in memory. Instead, we can keep track of the online users within the `Presence` process, and pass separate events to the LiveView, which can use a stream to update the online list.