4 ms·
Vue's templating engine, honestly, seems somewhat poorly thought-out. The usual <div :something='stuff + "here"'/> way of writing it errs on the side of HTML o
by koboll 8y ago
Vue's templating engine, honestly, seems somewhat poorly thought-out.
The usual <div :something='stuff + "here"'/> way of writing it errs on the side of HTML over JS, using quote marks awkwardly to enclose a statement rather than JSX's more sensible curly brackets. It makes it harder to visually parse, and it's sometimes annoying to not be able to use one type of quote marks unescaped within the statement.
Overall, this is one of many ways in which Vue (like Angular) seems like HTML with functionality tacked on, as opposed to React, which is closer to idiomatic JS. I've used both extensively and I don't think I can recommend Vue over React anymore -- unless you're, say, prototyping and looking to build an app entirely on the client, with no build step, where Vue really shines. Or unless you're doing something HTML-centric, like converting a static site.
- jimmy1 8y agoI have to agree with this. Ultimately whether or not you like Vue or React better boils down to if you agree with the semantics of the web, and including them in your app building process (i.e you like html, and css, and just want to "pepper" in some logic and interactivity with JavaScript), or if you would rather just embrace JavaScript whole-heartedly. Vue relies too much on overloading the string type for my taste (fundamentally, all JS libs do this to some extent). Too much magic happens with these string-based v-bindings. Irrespective of that, these days I am hard pressed to not use typed JS in some form or fashion anyways.
- enraged_camel 8y ago>>Irrespective of that, these days I am hard pressed to not use typed JS in some form or fashion anyways. What do you mean by "anyways"? I use TypeScript with Vue and it's great.
- jimmy1 8y agoDespite whatever framework I use, I believe adding types improves it and reduces bugs, Vue included. (These days I'm favoring ReasonML and that skews me to React, but I believe Vue.js is also available on Bucklescript)
- Rapzid 8y agoI could see it being great if everyone on the project were writing class components and using JSX. String templates and extended objects? Mutiny.
- dpisk 8y agoAs far as component libraries that start from HTML, I think Marko has the best syntax. Attributes are always parsed as JS expressions, for example. There's still some quirks, but overall it's pretty nice. https://markojs.com/docs/syntax/ https://markojs.com/docs/syntax/ There are some benefits from just embracing JavaScript though, especially, as you mention, integration with things like TypeScript.
- pbowyer 8y agoThat attribute syntax is awesome! I've found VueJS's handling of attributes to be somewhat confusing, sometimes getting a different type passed through than I was expecting. Marko takes the approach that would least confuse.
- airstrike 8y ago> rather than JSX's more sensible curly brackets I'm still waiting for the 2019 equivalent of http://haml.info/ http://haml.info/
- hombre_fatal 8y agoI think Pug is the closest thing to Haml with traction: https://pugjs.org/language/conditionals.html https://pugjs.org/language/conditionals.html Here's a Pug -> JSX transformation: https://github.com/pugjs/babel-plugin-transform-react-pug https://github.com/pugjs/babel-plugin-transform-react-pug Detouring from the most popular path tends to come at the price of tooling idiosyncrasies that are rarely worth it, but it seems to at least work with eslint-react and has syntax highlighting in some editors.
- airstrike 8y agoLove it! Thanks for sharing
- mateuszf 8y agoHow about Hiccup? Some examples here: https://reagent-project.github.io/ https://reagent-project.github.io/ It's not haml, but I'd argue it's awesome.
- airstrike 8y agoThanks. Seems nifty but ClojureScript is a bit too foreign for me
- Rapzid 8y agoMy least favorite part of Vue. Proper intelisense/checking for the templates never materialized either. A start-and-stop effort or two languishing in the Github issues.. I have a feeling after Vue 3 hits and in a couple years JSX will be the defacto way to work with Vue.
- petepete 8y agoPutting three bits of code/markup written in different languages in the same file was always a bad idea.
- Can_Not 8y ago> using quote marks awkwardly to enclose a statement rather than JSX's more sensible curly brackets Sounds like you should be making more use of computed properties and component methods.
- deleted 8y ago[deleted]
- yughurt 8y agoUse JSX in your Vue. It's supported just fine.
- wishinghand 8y agoNon string values in props and attributes is basically my only complaint about Vue, but saying that it's HTML with functionality tacked on is so completely uninformed. It's got all of the functionality of React, and can do cool stuff with slots (both scoped and unscoped), renderless and/or functional components. The "I wouldn't use Vue except for a small project" meme really needs to die too. Vue's build process is mature, has server-side rendering, and is used by some of the biggest companies in the world. If it's good enough for them at scale, it's good enough for the rest of us.
- furicane 8y agoBasically, what irks you is that Vue separates presentation (visual) from the logic via <template> and <script>, reusing components via HTML elements is poorly thought out and binding values to attributes is bad because hey, you can actually use JS to compute the value. Naturally, even though you can disregard the templating and resort to idiomatic JS, like one in React, you managed to develop an opinion after not using the features you like. This just makes no sense honestly. I'm all for people having opinion to the point where you can blatantly say "I hate Vue because I like React more", there's literally no need for justification. But spewing nonsense just to justify your preference is just bad. Are you a junior dev by any chance? I've used both extensively and I can recommend Vue over React because React is a pile of mental manure. I never understood React hype, but then again - IT is a fashion business, and when "leaders" invent crap - flies tend to follow.