Btw you missed :
Btw you missed :
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
Easy, just create a computed property in Vue.
If your point of view is that a model is meant for more than just doing the view, then yes, adding view only fields may pollute it for others (e.g., analytics).
But if your model is meant to drive the view of the app, then the story is very different. And some times you can't even tell if the model is just there to drive the view our not, since requirements change often.
I don't really know JSX much and without a specific example this is pointless to discuss. But basically JSX is syntactic sugar over javascript. A ternary is just a "if" condition so I don't see where is the issue here. Are you really using a template language devoid of conditionals? Even mustache the "logic-less" template has a form of it.
> The XAML file, as the HTML layer, should be completely devoid of logic and should delegate the whole work to the underlying model
The role of the model is and has always been to handle /business/ logic not presentational logic. If you put your dirty presentational logic inside my models I can tell you I will /never never/ accept your pull request.
* You don't know JSX
* You have no idea of the specific example posted in this thread that I'm speaking of
* You have no idea about WPF and what is a view model
But nonetheless you feel entitled to discuss about things in which you have zero knowledge. This is the JSX code posted in this thread:
<div> {listOfThings.map(thing => thing.isX ? <X thing={thing} /> <Y thing={thing} /> )} </div>
Instead of this monstrosity in XAML would be like this: <ItemsControl ItemsSource={Binding ListOfThings} />
But of course for you is better the JSX code. Luckily for me you will never have to review any of my pull requests, I seriously doubt that you can accept something that you don't understand.
https://msdn.microsoft.com/en-us/library/system.windows.cont...
What is that if not an horribly verbose switch case for modifying the representation of different elements passed to the ItemsControl?
I am not advocating that the JSX is particularly pretty or clever. I am objecting to your crazy notion that there should be no logic in the representation layer.
<ItemsControl ItemsSource={Binding ListOfThings} />
If you are looking for exactly this feature you might be disappointed.
> Although not strictly associated with the MVVM pattern, Vue’s design was partly inspired by it. As a convention, we often use the variable vm (short for ViewModel) to refer to our Vue instance.
I am sure it wouldn't be very hard to develop such a layer within React if needed.
It gets really old to see people try failed experiments over and over again, which pretty much is what you are suggesting.
Also, you got some display logic in your examples there, buddy. If you can't see it then no wonder this conversation is going in a circle.