top | item 15054938

(no title)

donpinkus | 8 years ago

It's slightly less easy to read than <li ng-each={myList}>...</li>

But it means you don't have to learn a library's HTML API.

Or when you want to loop through myList, but exclude a few particular items... you know how to write that in JS, but have no idea what to do in the mark up language. You could create a filteredList, but it's often not ideal

discuss

order

tigershark|8 years ago

I cannot really understand how today mixing logic and presentation in JSX is considered a good thing. The first principle when writing complex systems should be to completely separate the logic from the presentation layer. Nowadays people seem happy with intermingled monstrosities like the one shown in the JSX code upstream.

HeyImAlex|8 years ago

All of the "logic" inside render is _presentational_ logic. What would be a better place for that to go?

infensus|8 years ago

Because you don't really understand separation of concerns

pier25|8 years ago

> Or when you want to loop through myList, but exclude a few particular items

Easy, just create a computed property in Vue.

yev|8 years ago

+1, Also as a side effect you will get a cleaner declaration of the filtered list (rather than making it a part of the rendering process, lol).

ghusbands|8 years ago

Yes, that's easy, but adding something to your model just because your view wants it rather seems like the cart driving the horse. If your view needs something that your model otherwise has no use for, then it does not belong in the model.

ramses0|8 years ago

and marko => `<if(...)><li for(...)> ... </li></if><else><i>no results</i></else>`