travisf
Partials vs LiveComponents
I’m curious on the distinction between partials and LiveComponents. The more I work with LiveComponents the less I feel the need to render partials in a LiveView, but I’m wondering if I’m missing something.
Most Liked
codeanpeace
I think the historical context is that within the current landscape/zeitgeist of web development, the V in the traditional MVC pattern has shifted from a more Rails-esque partial templates rendering style for encapsulating reusable chunks of HTML to a more React-esque Component rendering style, especially as it became acceptable again to colocate code for content (HTML), styling (CSS), and behavior (JS).
From partials to ViewComponents: writing reusable front-end code in Rails - DEV Community
An Introduction to the ViewComponent Gem - Honeybadger Developer Blog
sodapopcan
Ya, partials aren’t even required for Phoenix without LiveView anywhere, it’s components everywhere. There’s no need for partials in Phoenix anymore.
Last Post!
travisf
In general if I was replacing a partial I’d be referring to a LiveView component due to the amount of complexity/state that the partial would likely have contained. But yeah whenever possible I’d use Phoenix.Component if I didn’t need to manage state.
Popular in Discussions
Other popular topics
Latest Phoenix Threads
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









