Hacker News new | ask | show | jobs
by joerick 656 days ago
Biggest functional difference is that Vue's reactivity is built on Proxy objects, which lets you simply bind your view layer to your model layer and things just keep in sync, without any extra APIs to think about. React has useState which gives you a setter that you need to use with an entirely new object each time. In Vue you can just change a property deep inside the model layer and the view updates.

That's what's keeping me in Vue primarily. I think MobX does something similar in React but the API is clunkier than Vue.

On top of that, the API is just much nicer. None of the confusing functional language and concepts e.g. "what exactly did the programmer intend by this 'useEffect' call??"

1 comments

> In Vue you can just change a property deep inside the model layer and the view updates

I never used vue for production apps, but my feeling tells me this could be a problem when the app becomes big. If you change a prop deep inside the model layer the chances of triggering an unintentional view update are higher? By using setters, you're essentially creating a more structured and controlled way of updating your application's state. But I have the react googles on, maybe I am missing something :)

The two binding happens in context of forms and user editable fields only. So, it is actually mirroring real world of a value can be changed from two different sources I.e. HTML and javascript.

Once you are in js land, changes occur in one direction only, I.e. from parent to child. Child cannot update parent directly via two way binding. Child need to emit an event. This brings vue in line with react to issues and semantics.

Ok then the parent is talking about those situations (forms and user editable fields) not about state in general in the library, correct ? If that’s the case, weird comparison.