Is ViewComponent the Future of Rails?
I've heard a lot about this library called ViewComponent from Github, and I wanted to see what the excitement is all about. So after spending a few days playing with the library, I was surprised by what I found.
🎥 Join my new Ruby on Rails Course here: bit.ly/3psxFEP
Read the tutorial here: mixandgo.com/learn/ruby-on-ra...
Link to the Github repository: github.com/mixandgo/react_vs_...
The article that I reference in the video: thenewstack.io/what-a-former-...
#rubyonrails #hotwire #react #reactjs #rails7 #viewcomponent
Пікірлер: 32
Fantastic review. Really fair evaluation.
@mixandgo
6 ай бұрын
Thanks for watching Sebastian
Thanks for sharing.
@mixandgo
Жыл бұрын
Glad you liked it
thx for this video !
@mixandgo
Жыл бұрын
You bet!
Thanks for the video! I like how you look both at what's good and what could be better. I'm curious why not just use partials to obtain the same benefits you mention (reusability, design system, etc.)?
@mixandgo
Жыл бұрын
It's possible to do that using partials. It's just that this library makes it a bit easier if you're willing to depend on a 3rd party library for that. But you should always think twice about using a library for such a big part of your app. History has proven that's often a bad idea. Personally, I like to stick to partials as much as possible.
@dfriis
Жыл бұрын
@@mixandgo Thanks for sharing. That was exactly my thinking. I feel I've been down this path before with a 'clever' new approach that turns out to be more of a burden later.
@mixandgo
Жыл бұрын
@@dfriis yup, same here.
i just started learning rails
I am under the impression that we should be using the rails api and any of js framework in frontend to build new applications. Now that stimulus and viewcomponent is here what do you think can these be used instead? Is it worth learning and using? I want to know your thoughts on this
@mixandgo
Жыл бұрын
Of course. That is exactly why Hotwire is so interesting. Instead of building two different apps, not to mention all the challenges that come with that, you only build one.
@ashutoshdevshali2933
Жыл бұрын
@@mixandgo thank you for the reply. I will be learning to work with hotwire and see what I have been missing.
@silencipher
Жыл бұрын
I also have the same impression. Rails asset pipeline changes frequently and upgrading rails versions is a pain because of this. Using rails for apis only and using a frontend framework seems to use the best of both worlds
@mixandgo
Жыл бұрын
@@silencipher I disagree. To me, Hotwire is the way to go.
What is that chrome extension that fill the form automatically? 🤔
@mixandgo
Жыл бұрын
chrome.google.com/webstore/detail/fake-filler/bnjjngeaknajbdcgpfkgnonkmififhfo
I appreciate that you gave it a good in-depth look and worked to find the useful aspects. I just can't shake the feeling that this is pretty over-engineered even for what it *is* able to achieve. You mention that with some updates this might become more useful - what additions could you imagine to make this a good pickup?
@mixandgo
Жыл бұрын
I would love to see an easy way to isolate and/or incorporate all dependencies, so if for example you have a form that depends on a controller, or some non-global css. A gem (like devise) would be a close example. What I'm going for is, plug and play functionality. Forms are the first thing that comes to mind.
you have a misspelling on one of your links above, instead of 'mixandgo', you've for 'mxiandgo'..
@mixandgo
Жыл бұрын
Thank you Martin
What vscode theme is this?
@mixandgo
Жыл бұрын
I think it's Community Material Theme Palenight High Contrast
Man but is not a good idea create a lot of components wrapped in helpers, uf you create a lot of helpers your aplications run slow because helpers is loading in the initial time when start your aplication for this reason was creating concept as drapoer to create decorator and load in demand. What do you opinion?
@mixandgo
Жыл бұрын
I don't think that's the case... why do you say that?
reusable? ain't partial does that job?
Just like Angular components but instead of type script Ruby is involved.
@mixandgo
Жыл бұрын
I don't think that's a fair comparison. Everything happens on the back-end here. There's no client-side logic at all (unless you add JS).
@drnicwilliams
Жыл бұрын
Right, it’s a component system for server side organisation/rendering, independent of how you might do your JavaScript or CSS.
Does it make sense for regular web apps? At first it makes sense, then you see the complexity of the code going uphill. viewcomponent is produce of react fanboys. They want to complicate everything possible in name of testability