Re:Why I left React for Vue
by ng12 on Tuesday December 25, 2018 @10:20PM
(#18760264)
But it's a lot of syntactic sugar. There's a second, stringly-typed language embedded in your HTML template.
[ Parent
| on HN ]
Re:Why I left React for Vue
by mattigames on Tuesday December 25, 2018 @10:28PM
(#18760286)
The only reason for it to be "stringly-typed" is that your IDE doesn't support it.
At the end of the day, it's much more of a hack. The IDE having to guess at what the string does is ridiculous to me, and it's just a ton of extra work for the person who wrote the IDE for no real reason. And now if you want to embed a string inside you need to switch quotes. Plus formatting gets super weird if you have a multiline condition. It's also super confusing for new users. There are so many issues I see with that design that I can't begin to understand why someone would argue in favor of it.
A lot of people are familiar with it (and that style) via AngularJS. It may not be as pure, but it's what they know.
Re:Why I left React for Vue
by mattigames on Wednesday December 26, 2018 @12:42AM
(#18760799)
An IDE doesn't have to guess anything, if the string is preceded by v-if then is code, that's it. Pretty much how a string literal inside eval() could be parsed as code.
What if another library uses v-if? Or there's no library loaded at all? What if I just wrote a new library that uses c-if? I imagine most IDEs approach this by looking at the string and trying to guess whether it's HTML code or not.
It's still stringly typed even if someone wrote an IDE plugin that tries very hard to make it safe.
So just like JSX then?