2025 Rails frontend solution: Phlex or ViewComponents?
I'm just wondering what everyone's opinions are on the two. I've always leaned into ViewComponents, but it seems like Phlex is on the come up. What has everyone's experience been with the two as of late?
Side note, I'm a big fan of inertiajs (and wish it was something more considered by the Rails team), however, I am trying to stay closer to Rails and Ruby rather than React, Vue, Svelte etc.
I think Phlex or View Component is mostly personal preference. Phlex will be all Ruby and View Component can be a mix of Ruby classes, ERB, and sidecar Stimulus controllers contained in the same folder. Either way you go they're pretty similar.
I implemented ViewComponents in mortimer.pro first but got pretty frustrated with alle the files needed for setting up a component. With Phlex it's one class and you're away. Only issue I have with Phlex is the "buffer" but if you keep your component in the class and don't let it "stray into ERB" all is well :)
I’ve used both ViewComponents and Phlex recently, and I feel Phlex offers a cleaner, more Ruby-native experience. ViewComponents still feels more mature though, especially for larger teams.
I’ve bounced between both this year, and honestly it comes down to team style. Phlex feels cleaner and more Ruby-native, great for smaller teams or solo work. ViewComponents is still the safer choice for bigger apps since the structure and tooling are more mature.