There looks to be a misprint on page 217 of Book version: P1.0—March, 2026. A code block is displayed of a <.form> component with an explanation underneath that says:
“Notice that our form is contained within a root
element. All live components require a single root element in their HTML templates. Also notice that we’re using the <.simple_form> component defined in the CoreComponents module.”
However, the code block this is referring to does not contain a <.simple_form> component for a <.form> component. Additionally, there is no demonstration of a form component contained within a root
However, the code block this is referring to does not contain a <.simple_form> component for a <.form> component. Additionally, there is no demonstration of a form component contained within a root
element as the text states. Perhaps the code block was accidentally pasted here and something more akin to what is seen on page 219 was meant to be pasted there. Page 219 has the following:
“““
<.simple_form
for={@form}
phx-submit=“save”
id={@id}
phx-target={@myself}
</.simple_form>
“““
Yet this doesn’t have root
element displayed either.