Live data from Hacker News

Vue.js 3

github.com

141–150 of 308 posts

Re: Vue.js 3

#141
post #38

I 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?

[deleted]

Re: Vue.js 3

#142
post #44

I was hoping for better Typescript support for typing properties, since that is where 90% of our type errors occur. But it seems like you still have to specify the types manually. The example from the manual: const Component = defineComponent({ props: { name: String, success: { type: String }, callback: { type: Function as PropType void> }, message: { type: Object as PropType , required: true, validator(message: Comp…

It's not that we can't implement it like that, the real challenge is in minimizing breakage from v2. We decided it's better to not completely alter how props are declared because that would be too much breakage. Instead, there's the compiler-based approach with ` `: https://docs.google.com/presentation/d/1VjBM6ae-fuawK1TltYLX... (runtime props definitions auto-generated from TS interface)

More detailed info: https://github.com/vuejs/rfcs/blob/sfc-improvements/active-r...

Re: Vue.js 3

#143
post #38

I 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?

Vue and React are more than templating engines. They decouple the state and view of your application. This means your view becomes a function of state, and you only need to worry about state. This solves the problem of trying to keep your view in sync with the application state, which probably everyone who has done some webdev for more than 5 years still has nightmares about.

Re: Vue.js 3

#145
post #115

Earlier quoted context omitted.

This is a popular opinion particularly if all someone pays attention to is Twitter and Reddit but I'd argue it is a wrong opinion. Angular is alive and well, and being used/adopted every day for projects no one hears about. It isn't the "sexy" choice, but it is the one a lot of companies make. And if you're gonna point to opinion polls, and all kinds of respect to those who put them out, but they have a hard time cap…

Depends where you live and work I suppose. I used to work in a consultancy firm in Norway that was all in on Angular two-three years ago. Angular has been very popular in enterprise here. But Twitter and Reddit reach enterprise too in the end. The consultancy firm has now switched more or less entirely over to React because Angular is so out of vogue.

US consultant here with a similar story. A lot of what we're doing now seems to be moving toward headless CMS and headless ecommerce with NextJS/Gatsby for the integration point. I'm still a big fan of Angular, but the amount of work we're getting asking for Angular has dropped off a cliff.

Re: Vue.js 3

#146

if this means no more Vuex, i'm all for that. that extra abstraction layer never proved useful to me.

Out of curiosity, how do you handle data needed by tons of components at different tree depths (info about the current user for example)? I don’t always reach for Vuex, but when an app reaches a certain size it sure beats passing every bit of common data down through the entire tree, as I find you quickly hit a point where you’re passing data to components solely so it can pass it to it’s children.

Since the reactivity api is exposed it's very easy to write a file to hold whatever state you want.

Benefits: easy to create, type safety is simple.

Drawbacks: you don't get a serializable state log for free (that can be recorded and replayed when hitting bugs).

Re: Vue.js 3

#147
post #126

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.

Why can't React do the same?

I'm not sure about React's capability with this, but Vue can very easily run with no build stage. You can load Vue from a CDN and use a couple lines of JS to point it at a DOM element in your app. Then you can write a plain JS Vue object (what goes inside the tags in a .vue file), and all this logic will apply inside the element you pointed it at. You can also write components, although that gets a little clunky without a build stage.

This has allowed me to do things like create Vue-based tools in a locked-down corporate environment where I was not able to install Nodejs on my machine.

Re: Vue.js 3

#149
post #126

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.

Why can't React do the same?

Please someone correct me if I'm wrong. It seems like you can only implement React using the full "modern JS stack", i.e. Node/Webpack/...

So if you want to use it on one page, it's a hard sell to set up all that infrastructure (and document it for the team)

On some sites I've used Vue.js by simply adding a tag with vue.min.js.

On sites already using Gulp or similar, it's pretty simple to incorporate the Vue bundle and use it on one or a few pages.

Re: Vue.js 3

#150

Earlier quoted context omitted.

Why can't React do the same?

I'm not sure about React's capability with this, but Vue can very easily run with no build stage. You can load Vue from a CDN and use a couple lines of JS to point it at a DOM element in your app. Then you can write a plain JS Vue object (what goes inside the tags in a .vue file), and all this logic will apply inside the element you pointed it at. You can also write components, although that gets a little clunky with…

React can, but less ergonomically than most developers are used to.
Post reply on HN