I just started vue 3 and its incredible compared to my experience with react. Way to go Vue team!!!
Could you expand on this a little more? What is it specifically that makes it incredible compared to React, in your opinion?
81–90 of 308 posts
I just started vue 3 and its incredible compared to my experience with react. Way to go Vue team!!!
Could you expand on this a little more? What is it specifically that makes it incredible compared to React, in your opinion?
is reactive() just a mere wrapper around ref() ?
Kind of -- reactive() lets you declare multiple values at once, and you can read the property directly. ref() is for single values, and to get at the actual VALUE, you need to use "myRef.value" const state = reactive({ msg: "hello", count: 1 }) state.msg // "hello" const msg = ref("hello") msg.value // "hello" Though when you use ref()'s in templates, it will bind to .value for you.
Do experienced Vue devs actually use both regularly?
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?
Which template engine? Then what if you realize you need a router? Then the developer who glued those together leaves, and all you can hire is juniors. There are benefits to using the industry standard (which today I consider Vue, React, Angular and slowly Svelte), you can learn it quickly, as it has ton of resources and you can hire easily, as you aren't forcing someone to use some obscure, home baked js framework.…
Then you are in trouble regardless of what you use :-)
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)
My only wish now is for the TSX experience to be rounded out. From a reactivity standpoint, Vue has a much more ergonomic/easy to use API for handling component state, effects, and computed values (in my opinion) than React. But in the last 6-8 months, I've leaned away from Single-File Components because when you want to do something like define a bunch of small components, it's a lot more difficult to do than with m…
> Unfortunately, this is a weird stance to take in the Vue community, almost nobody uses JSX/TSX. Typed components is 200% of why I'm writing React these days. Angular has typed components too (they went in on TypeScript early), but the Angular Language Service / IDE integration didn't come to later-- so for a period, no intellisense. But having intellisense while writing TSX is so wonderful, especially when you're w…
I have to hop back and forth between Vue and React frequently and the experience of writing a TSX component is pretty nearly identical.
For stateless components -- it's literally the same syntax as React.
For stateful components, you just need to wrap your component in "defineComponent()" and your TSX elements get returned from a closure in "setup()".
i learned vue2 3-4 years ago. should i learn vue3 or svelte instead?
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)
i learned vue2 3-4 years ago. should i learn vue3 or svelte instead?
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?
Sure, you can use HBS (or even vanilla) to render a piece of dynamic HTML. That's not really the problem these libraries are solving. You could also create your own components with HBS templates and figure out how compose them to render a tree of components. That's not too hard to figure out either. The problem is really in updating the DOM when state changes somewhere in your application. In the jQuery days we had t…
Say a function changes the cars array. All it has to do to update the DOM is:
document.querySelector('#cars').innerHTML=carsTemplate(cars);
Where carsTemplate is a HandleBars template that on page load has been initialized with the html to render the list of cars.