4 ms·
As someone that doesn't do much frontend I was pleasantly surprised by Vue after playing with it last weekend. The only thing that confused me is that the Vue c
by polack 7y ago
As someone that doesn't do much frontend I was pleasantly surprised by Vue after playing with it last weekend. The only thing that confused me is that the Vue community talks about Vue 3 as it's already been released, but I couldn't find a single trace of even a v3 beta on their website or Github. The reason is probably easy to find with a search engine, but still weird (as an outsider) that it's so well hidden on the official channels.
- fehrge 7y agoI believe v3 is on their github as https://github.com/vuejs/vue-next https://github.com/vuejs/vue-next
- trystero 7y agoAgreed, as per the package.json on master this is version version 3.0.0-alpha.4.
- plopz 7y agoI found that Vue 2 was very nice when I was playing with it for simple things as a toy. But as soon as I started to try more complicated things, the reactivity system just fell apart. There are just some fundamental mismatches between how JS references work and how the Vue 2 reactivity system works. Once you learn the pitfalls however (like never de-reference in data, only access shared state through computed, dont bother trying to use data structures like Map or Set), it becomes nice again although in the process it loses its luster. I believe Vue 3 is supposed to fix much of this, but its unclear whether its going to be backwards compatible.
- iovrthoughtthis 7y agoI agree. I’ve been burned by the reference management and reactivity. Vue 2 doesn’t let you manage your data separate from Vue it’s self, the data tree needs to be inside Vue.
- jppope 7y agoyep. thats intentional... you can have multiple instances of vue going and it also plays nice with jQuery so that you can add Vue into your project without messing everything up. Also worth noting its not 100% true you can't manage your data separately you just need to manage the reactivity yourself.
- plopz 7y agoDo you mean writing your own get/set observables? I've looked at how Vuex does it and internally it just wraps the data in a Vue instance. https://github.com/vuejs/vuex/blob/dev/src/store.js#L280 https://github.com/vuejs/vuex/blob/dev/src/store.js#L280
- iovrthoughtthis 7y agoI don’t understand how (or why) managing the reactivity of data and having multiple instances are coupled. Also, implementing your own reactivity is very unintuitive. You need to implement your own “diffing” (is this change worth rendering) to know when to force Vue to render. This is definitely not how Vue was intended to be used.
- BiteCode_dev 7y agoCorrect, but it's the same with alternatives. E.g: redux uses a react provider to inject the data into the component tree because of this. Vuex does the same for vue.
- Epskampie 7y agoUntrue. Using Mobx your model can be defined completely independently from your view layer like React.
- iovrthoughtthis 7y agoNo it isn’t. React will simply render the object you give it. That means that React doesn’t need to know when data changes, it simply renders the ui, diffs it to the current ui and applys the changes. Unless your using component state but even then, it’s the rendering that measures change. The act of updating the state just lets React know “time to see if anything important changed”. Vue seems to tra Co data changes granularly which means it needs to understand the change at the point if mutation. This means it needs control of the data you want to render.
- BiteCode_dev 7y agoI believe backward compat is a goal of vue 3. In all honesty, the pitfalls are not that many, easy to understand, learn and avoid or get out from. I spent way more time trying to figure out doing even basic things in react than debugging reactivity in vue. Espacially since the later has a fantastic doc and a small api.