Components with Phlex in Rails Discussion
I feel like components in Ruby are super duper handy for arguments and other complex helper methods. Phlex takes it a step further with the HTML helper methods so you don't even really have to leave Ruby while you're coding. Pretty cool stuff!
I love Phlex. I've added it our work codebase, starting with our email templates. Massive improvements!
Also used it in a few side projects at home, but I am not sure where to put the javascript?
How do components work with turbo frames and streams?
No different than html.erb views. Both just generate the HTML independently of the JavaScript.
Great intro to Phlex. Now I need to work out if I like it more than ViewComponents, and if I want to switch :)
Agreed, I've already migrated some views to ViewComponent, and now I'm at a crossroads.
Thanks, Adam, great intro to Phlex! I appreciate how you took one step at a time -- including the errors -- and didn't try to polish too much beforehand, letting us work through and fix the problems with you.
Я хочу переписать view на phlex, как быть с partial ? а как выводить collections ? я не понял принцип . Help
Thanks for the discussion and I can only agree! Only disadvantage, in partial on projects where cancancan is applied: Instance variables from the controller cannot work inside a view and have to be passed as argument. We are currently using HAML and on this point the advantages and disadvantages balance each other out.