top | item 22626419

(no title)

aliveupstairs | 6 years 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.

discuss

order

TekMol|6 years ago

It 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.

otabdeveloper2|6 years ago

How 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.