Vue is the only one of the most popular 3 frameworks that can easily be used on a minimal basis to sort of "spruce up" old applications by selectively adding it here and there in the templates. Seems like they should try more marketing and community outreach toward that end. Gradual adoption is a feature / selling point not many web development frameworks can claim.
Vue.js 3
281–290 of 308 posts
Re: Vue.js 3
#282I don't know if React could allow set children's data via parent, like $childRef.setData({ data }) When i see this code in a Vue codebase, my mind got hurt. I still prefer React due to its consistent reasoning about data flow in the app.
That sounds like the equivalent to React's forward refs. https://reactjs.org/docs/forwarding-refs.html
First, `$childRef.setData()` appears to be the conceptual equivalent in React of `childClassComponentInstance.setState({someField})`. While that's technically possible, it's _extremely_ non-idiomatic in React and completely discouraged.
Second, "forwarding refs" is a feature specifically designed to allow a component to apply a ref to something _inside_ of itself. For example, the React-Redux `connect` API uses ref forwarding to allow `` to hand back the inner wrapped component, not the outer wrapper component from the library. It doesn't have anything to do with calling a state setting function on a component in and of itself.
Re: Vue.js 3
#283Earlier quoted context omitted.
I find this attitude towards front-end developers unamuzing. If you have a beef with subset of developers in your workplace that happen to to work on the front-end, you should not take your frustration or generalize their behavior over an entire industry.
I don't know what it is about the Node.js ecosystem which leads to the dysfunction, but there's definitely dysfunction, and it's definitely endemic. Compiling our front end assets takes longer and more CPU than our entire back end with many multiples the amount of source code.
To add to this the Node ecosystem seems somehow to encourage outsourcing extremely simple pieces of functionality (leftpad anyone?) so you end up including a bunch of crap that you don't really need, all because someone didn't feel like using 10 lines to reimplement something simple.
Re: Vue.js 3
#284I still don't see a reason why one would use Vue or React. I agree that templating of data is something you should use a library for. But there are great templating libraries. Handlebars for example. Can someone give a short example of code that would be more elegant using Vue then just a simple template engine?
This link might contribute to your evaluation. It's a seemingly reasonable overview of the top three frameworks. Author recommends using all three, spoiler?
Re: Vue.js 3
#285Earlier quoted context omitted.
I don't know what it is about the Node.js ecosystem which leads to the dysfunction, but there's definitely dysfunction, and it's definitely endemic. Compiling our front end assets takes longer and more CPU than our entire back end with many multiples the amount of source code.
I think it's that JS has no standard library, so dependency graphs are an endless fan-out instead of fanning back in after a while. That's how you end up with 900 dependencies after importing a single Node module, because every author of every upstream lib chose a different way of doing the same thing. To add to this the Node ecosystem seems somehow to encourage outsourcing extremely simple pieces of functionality (l…
Endless dependency graphs and single-function modules and left-pads weren't a problem back in the days of JQuery and sane libraries. None of this madness is necessary. No, not even for front-end frameworks. It's unnecessary in the vast majority of cases.
Re: Vue.js 3
#286Earlier quoted context omitted.
You've moved the goalposts from "not possible" to "not as idiomatic"
Look, I gave a challenge to implement FAQ page answer toggling on top of legacy PHP HTML. Show me that it's possible to do it in react in a not god awful hacky way without refactoring the backend first, then explain how it's comparable to a vue one using v-ifs, then we can knock off ourselves out debating semantics.
You don't have to refactor much I think. You can inject the data into global scope in your PHP template, before you include React script. I'd do something like `window.__PAGE_DATA__ = "";`.
Then, in your React code you'll be able to access it in a pretty idiomatic way for React. Instead of calling `fetch` or something similar, you'll have to call `JSON.parse(window.__PAGE_DATA__)`. You have to use `try`/`catch` block around it as well to handle errors from JSON parsing - just like you have to have the same block around `await` calls. You can treat the data as immutable to a degree as well - accidental local property updates will not get to the global scope, you'll have to set the property in `window` object.
I've used React in a few projects, embedding it into a Wordpress website using this approach. Seems to work well for me, but YMMV.
Re: Vue.js 3
#287Earlier quoted context omitted.
That's not where they were wrong.
Look, I've used both Vue and React for this purpose and Vue is just easier to integrate. React can do it too, but Vue places an emphasis on it and it shows.
Re: Vue.js 3
#288Vue is the only one of the most popular 3 frameworks that can easily be used on a minimal basis to sort of "spruce up" old applications by selectively adding it here and there in the templates. Seems like they should try more marketing and community outreach toward that end. Gradual adoption is a feature / selling point not many web development frameworks can claim.
As far as I know, what you are talking about was the main reason React was created in the first place. All this FUD spread by the Vue fans is getting ridiculous...
VueJS has first class support for this use-case while React has "well technically no ones stopping you from figuring it out by yourself" support.
Re: Vue.js 3
#289Earlier quoted context omitted.
> What if there's another new sexy JS framework in the future? That's how a market works. It's a strong incentive to keep Vue sexy.
The market also isn't as volatile as people make it out to be. The top most used js frameworks (React, Angular and Vue) have been in the top spots for 5 to 7 years now. I guess the market might as well be settled. Of course there are some new comers every year, but they don't enjoy a large market share. Hell, I've not even seen VueJS used once in any serious project in the industry. React and Angular are here to stay…
I've been paid to write Vue code for at least 4 years.
Re: Vue.js 3
#290Earlier quoted context omitted.
These "75%"/"300%" numbers are ridiculous, the two numbers are calculated completely differently. At least be consistent. 100/25-1 = +3 = 300% increase 25/100-1 = -0.92 = 92% decrease
i think your math is wrong, bud. 100/25-1 = 3 (300% increase) 25/100-1 = -0.75 (75% decrease).