4 ms·
There’s a really great fix for this, which is to design JS frameworks to not take over the entire application. I have been waiting for a long time for the fram
by mbgerring 5y ago
There’s a really great fix for this, which is to design JS frameworks to not take over the entire application.
I have been waiting for a long time for the framework that will let me write a web component, and then include that web component in a regular HTML page, in a way that’s supported by the idioms and best practices of that framework.
It’s also worth pointing out that all of these drawbacks to rendering web pages on the front end via JavaScript were obvious the moment these frameworks were introduced. The critics at the time were right. But we still lack for easy-to-use alternatives.
- TZubiri 5y ago"There’s a really great fix for this, which is to design JS frameworks to not take over the entire application." But then your framework wouldn't replicate itself with the prolific genius of Genghis Khan or the coronavirus.
- dmalik 5y ago> design JS frameworks to not take over the entire application. Facebook did just that with React. React doesn't have to be used only as a single page app. Use it for just a single component on a page if you want.
- mbgerring 5y agoNobody does this in practice. Tooling, tutorials, frameworks, etc are all created around the idea that the entire application is an SPA with a single root element. I understand that it’s possible to do this in theory, and that’s why I said I want to see a framework where the idioms and best practices are geared for this kind of use.
- jkaplan 5y agoI'd encourage you to give React a try for this use-case! I've done this exact thing -- slowly introducing React in certain places in a large web app -- and it's worked great. You're right that tooling/tutorials are mostly geared towards SPA usage, but React itself is designed to work for both. You'll have to decide on a pattern for "bootstrapping" React in a given page or element, since there aren't well-established best practices, but after that it's smooth sailing.
- simonw 5y agoIn theory that's true, but I hardly ever see it used like that in practice.
- dntrkv 5y agoIn fact, that's one of the major contributors to React's success. It's so easy to integrate into an existing application. If you take any major tech company (that's existed before React) that has adopted React as their main framework, I will bet the majority of them are, to this day, running React in parallel with another framework (and many are running it WITHIN another framework).
- themarkn 5y agoWeb components have been a possible build target for Vue for a while. It seems totally possible to set up a Vue project like you’ve suggested, use all the Vue conventions & tooling, and output web components that you then use a la carte. Maybe I’m missing something about what you are looking for, but more details are here: https://vuejsdevelopers.com/2018/05/21/vue-js-web-component/ https://vuejsdevelopers.com/2018/05/21/vue-js-web-component/ And I’m sure the same can be done in other frameworks.