3 ms·
> a prop called "foo" & data/state param called "foo" are both accessed at this.foo, its no longer obvious what would happen if I would try to mutate this.foo.
by CaveTech 9y ago
> a prop called "foo" & data/state param called "foo" are both accessed at this.foo, its no longer obvious what would happen if I would try to mutate this.foo. It mutates the data/state, not the prop, so now this.foo refers to the value in the data/state, which has a different value from the prop "foo" which can no longer be accessed at this.foo
Well yes, but have props and state with the same name is again just code smell.
> See this page which says "Don’t use arrow functions ":
This is a very narrow restriction and pretty obvious why you shouldn't do it, ie it passes a context that makes no sense. This is not a Vue limitation.
> React has escape hatches to get out of your way
So does Vue, don't use the Vue `render` if Vue isn't managing the state.
- joshribakoff 9y agoHey you quoted my point about escape hatches but forgot to respond, interested to hear your thoughts. I guess to the 1st point, yes and Vue js allows this smell while React doesn't. Regarding 2nd point, I disagree it's narrow, it affects all methods for all components. But its not a big factor in deciding what framework to use. React is just a tad more "standards compliant" when it comes to web development, in my opinion. And in web development standards matter a lot, even when the standards themselves may not be great... I really like VueJS for what its worth, its still my favorite framework, but I'd bet my money on React in the same sense I would invest in Walmart even though its not the perfect business. The react ecosystem has a much higher learning curve also, to play devils advocate.
- CaveTech 9y agoSorry I responded but I forgot the newline. In either case react is clearly the better ecosystem, but vue is a really, really solid framework itself. We’ve hit our own limitations that we’ve had to work around, but imo most of the points you bring up have quite simple fixes. Cheers!