travisf

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

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

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

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.

Where Next?

Popular in Discussions Top

AstonJ
I’ve just started the Phoenix part of the utterly brilliant online course by @pragdave. On generating the Phoenix app he uses the --no-ec...
New
rms.mrcs
A couple of days ago I was discussing with a friend about different approaches to write microservices. He said that if he was going to w...
New
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New
wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New
marciol
Please, let me know if this kind of discussion already took place in another topic . Hi all, how do you consider if is better to build ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
matthias_toepp
I’d love to hear what people think about Wisp, the new Gleam web framework started by Gleam’s primary creator Louis Pilfold. Gleam, alon...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54996 245
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44608 311
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement