3 ms·
As another reply mentions, its a matter of taste, but for me its the clean seperation between data and presentation. Presentation is generally HTML+CSS. Data an
by reza_n 10y ago
As another reply mentions, its a matter of taste, but for me its the clean seperation between data and presentation. Presentation is generally HTML+CSS. Data and plumbing is JS. This is similar to traditional MVC and works well with mixed dev/designer teams. Dev in JS, design with HTML+CSS. You can liken it to a data API returning data with HTML in it, you now have data and presentation together. Do you want the 2 roles in 1 convenient language? Great, JSX gives you that power. Do you want data and presentation separate, then go with templates.
- eyko 10y agoYour component's logic is all presentation logic. You may want to break it even further but it's not a real separation (you still have logic in your templates via `v-if` and `v-for`, don't you?). Data, in both React and Vue, lives outside the component.
- reza_n 10y ago'For' and 'if' are very basic operations which have equivalent CSS constructs and play extremely well with HTML presentation. I'm not saying your wrong, I'm just saying its a total non issue for designing presentations. Without it, you cannot present modern data (JSON).
- Noseshine 10y agoSo whose preventing you from only using the same basic structures when embedding it like JSX, with Javascript? I don't see why learning a different syntax for the templates improves anything you say. The for loop does not look any better/easier just because you slightly change the way you write it, but you now depend on yet another language.
- reza_n 10y agoWhat's preventing me? My preference for a different kind of separation between data and presentation. No one right or wrong here, just a matter of taste :)
- Noseshine 10y ago> separation between data and presentation That makes no sense. Reminder: We were talking about Javascript vs. custom template language - both are programming languages. One more limited than the other, but that is when I asked why you don't just use the same subset of Javascript. Just variables and basic loops, for example. You have the exact same things in the template language!