3 ms·
I believe the templating is what's declarative, here. For instance, in Vue you can insert logic such as for loops, conditionals, event listeners, two-way data b
by aliveupstairs 7y ago
I believe the templating is what's declarative, here. For instance, in Vue you can insert logic such as for loops, conditionals, event listeners, two-way data binding and so on right in the template with directives (HTML attributes).
<Todo v-for="(todo, index) in Todos" :key="index"/>
Instead of an imperative JavaScript for loop.
- otabdeveloper2 7y agoHow in seven hells is moving imperative loop constructs from Javascript to HTML supposed to be "declarative"?! If anything, it's the opposite - you're now polluting HTML with imperative programming features where there previously were none.
- TekMol 7y agoIt is the same with handlebars. You put your todo element between {{#.}} and {{/.}} which means "do this for all elements" and then pass only the "Todos" array to the template. No loop in Javascript either.