dwyl / phoenix-liveview-todo-list-tutorial

✅ Beginners tutorial building a Realtime Todo List in Phoenix 1.6.10 + LiveView 0.17.10 ⚡️ Feedback very welcome!
https://liveview-todo.herokuapp.com/
69 stars 11 forks source link

Live Components #69

Closed SimonLab closed 1 year ago

SimonLab commented 1 year ago

So far in this tutorial we have put all the template code into a single file: /lib/live_view_todo_web/live/page_live.html.heex That is "OK" in a mini project like this, but it will quickly become unmaintainable in a larger LiveView codebase. We are therefore going to proactively migrate the templates to using PhoenixLiveComponents`.

see https://hexdocs.pm/phoenix_live_view/Phoenix.LiveComponent.html

Check the heex file https://github.com/dwyl/phoenix-liveview-todo-list-tutorial/blob/main/lib/live_view_todo_web/live/page_live.html.heex to see which parts can be extracted to its own component.

This heex file is not big, however creating a component will be used as an example on how to do it for bigger files.

SimonLab commented 1 year ago

check dependencies mix hex.outdated: image

Updating phoenix_live_view to 0.18 will create some breaking changes. I'll start by fixing those

SimonLab commented 1 year ago

Warnings and error after updating dependencies: image

Fixed with https://github.com/dwyl/phoenix-liveview-todo-list-tutorial/pull/70/commits/8fb1faeaa62a760bcef2236d4a269f662495b22a

nelsonic commented 1 year ago

Fixed. ✅