Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add doc examples using attach_hook for code organization instead of L…
…iveComponents (#3685) * Update attach_hook/4 with extract handle_event example * Add small header for doc linking * Clarify the code-organization sections of the Welcome guide Add small hierarchy headers to the "Compartmentalize state, markup, and events" section Use the guidance in "Functional components or live components?" at the top of `Phoenix.LiveComponent` to avoid using LiveComponents only for organization Provide longer example with a few different alternatives of what *can* be used for organizing events * Remove suggested option to delegate events manually As pointed out, sticking with attach_hook keeps ownership of the event in the new component * Remove Helpers and use more-standard {:ok, socket} style * Add forgotten line break * Remove 2nd attach_hook example and link directly to the first * Update lib/phoenix_live_view.ex * Update guides/introduction/welcome.md * Update guides/introduction/welcome.md * Update guides/introduction/welcome.md * Update guides/introduction/welcome.md * Update guides/introduction/welcome.md * Update guides/introduction/welcome.md * Update guides/introduction/welcome.md * Reverse locations of long-code-example & link-to-that-example Now the "using attach_hook/4 to extract handle_events" example code is actually kept in the doc FOR attach_hook This keeps the welcome.md page similar to it's original size * Rename "Organizing code" section -> "Sharing event handling logic" * Continue minimizing changes to welcome.md - Merge the "attach_hook/4 to organize event handling" section into the "Function components" one above it - Return to the previous bullet-point based summary, adding only a single line to emphasize that function components can work alone for markup, but also organize event handling when paired with attach_hook/4 * Apply suggestions from code review * Apply suggestions from code review --------- Co-authored-by: Gary Rennie <[email protected]> Co-authored-by: Steffen Deusch <[email protected]> Co-authored-by: José Valim <[email protected]>
- Loading branch information