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.
No, but he knows that templating languages have been wrestling with pretty much the same three or four issues since the beginning of HTML templates. It gets old.
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.
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.
I asked you to please don't speak about things that you don't know.
The page that you linked has nothing to do with presenting multiple items with different types.
It is defining the visualisation of the control itself, defining the arrangement method for the contained items, defining the same visualisation for each item and finally it defines the container visualisation for each item.
To replicate the JSX logic in the example discussed the code that I posted is all you need.
It will bind the source of the ItemsControl to a list in the ViewModel that contains the different ViewModels that you need to display.
WPF automatically will find the DataTemplates defined for those ViewModels and use that in the visualisation.
No if, no switch, no map and nothing at all in the XAML file.
Just:
I think you are comparing Apple with oranges here. React doesn't have a ViewModel notion that would binds data with Component. The binding is happening in the templates themselves so in the Component themselves and there is no in-between layer AFAIK.
If you are looking for exactly this feature you might be disappointed.
I have used those 2 frameworks in the past. Could you point me to the documentation about ViewModel in Vue.js I wasn't able to find anything relevant other than:
> 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.
* 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.