6 ms·
This looks like it takes Vue.js's approach of creating a brand new language that you have to learn (in this case MVL which is similar to HTML). It's definitely
by sbjs 8y ago
This looks like it takes Vue.js's approach of creating a brand new language that you have to learn (in this case MVL which is similar to HTML). It's definitely a preference for a lot of people, but I prefer React.js style, which lets you use languages you already know (HTML and JavaScript) to do literally everything. It may be inconvenient at times, but you don't have to reference a new language's manual every time you want to do a for-loop to figure out whether the @for attribute should go on the li or the ul.
- kbr 8y agoIt's definitely based on preference, but I designed MVL to be as simple and consistent as possible. For example, there are two ways to create a for loop (one on the ul and one on the li). <For={item in items}> <!-- multiple elements --> </For> <p For={item in items}><!-- single element --></p> This syntax works for every component ("For" is just another component).
- sbjs 8y agoThat is awesome that you have <For>! That's one of my biggest pet peeves with Vue.js, where it has to be an attribute on an element, and it's not intuitive whether it goes on the parent or the child. (I think Vue makes it go on the parent but I think it makes more sense for it to go on the child.)
- ppseafield 8y agoIIRC for Vue.js it goes on the child, i.e. <ul> <li v-for="item in items">[...]</li> </ul> It is something you do have to remember. I believe you can use a template tag too if you like.
- sbjs 8y agoAh right, thanks. Yes this always looks backwards to me. The body of a loop should be inside of it. But here it is the body of the loop. That is very strange.
- badestrand 8y ago> I prefer React.js style, which lets you use languages you already know (HTML and JavaScript) No, you also have to relearn, just not as much. The React docs rightly state "JSX is not HTML" because you cannot use comments, doctype and it's a shame that JSX deviates from HTML in attribute names. Having to use className instead of class annoys me to no end and is why I prefer preact (they use class). Also autoComplete and spellCheck - just why? Converting this-that to thisThat makes sense but renaming attributes without necessity was a stupid decision.
- spankalee 8y agoYou really should check out lit-html. The JavaScript parts are real JavaScript, and the HTML parts (in JS template literals) are real HTML.
- sbjs 8y agoWith a good IDE that suggests these as you type, it shouldn't matter. I recommend VS Code, it does this out of the box. I like how it even suggests the right thing if I get the letters a little mixed up, like typing "speclh" suggests spellCheck={...} for me. It's great!
- dosy 8y agois it weird that i prefer vim rather than fancy IDE for almost everything?
- zackify 8y agolet { class } = this.props Class is a reserved word. This is why they stuck with the dom attribute names. Because it is JS, not html :)
- badestrand 8y agoIt works very well with preact so it obviously is possible. edit: And while you pass it often as a prop (<a class=...>) you usually never access it yourself in components - and if you do, just do `this.props['class']`.
- spankalee 8y agoYeah, this is a big reason why the Polymer project is moving away from a bespoke expression syntax and control-flow in HTML, ala Angular and Vue, to using just JavaScript with lit-html. But not only does it mean that users don't have to learn a new language and concepts, but it mean the maintainers don't have to develop a new language and all the corner cases, feature requests and bugs that come with it. And in the case of lit-html, you also eliminate compilers completely because there's also no non-standard markup-in-JS syntax.
- vmware505 8y agoThere is handlebar, you can use it with Glimmer.js. It is still the fastest and future proof with WebAssembly.