4 ms·
Finally, somebody said it. I thought we abandoned that garbage when we left PHP, and now all of a sudden everybody wants to start mixing markup and code again?
by Mizza 11y ago
Finally, somebody said it. I thought we abandoned that garbage when we left PHP, and now all of a sudden everybody wants to start mixing markup and code again?
- daveidol 11y agoHyperscript is the same thing as JSX when used with React; just a different syntax. Either way you are "mixing markup and code."
- qaz_plm 11y agoSo there's hope for using tables again as layouts in HTML?!
- jhall1468 11y ago1) Like it or not PHP is still one of the top 5-10 languages used today. 2) The separation of concerns argument is completely invalid. They aren't separate concerns, they are separate languages.
- M4v3R 11y agoExactly this. Can someone explain to me what do people see in JSX way of creating components? What happened to good ol' code vs template separation and what's now wrong with having two separate files - .html (or jade, or whatever) and .js?
- bicknergseng 11y agoWhat does code/template separation actually achieve? Ignoring JSX for a moment, why are templates a good thing? Are you actually simplifying something by using {{#each}} instead of .map()? Is {{#if}} really better than if()? Seems to me like templates don't actually decouple code.
- js-bs 11y agoReact supports testable dumb components, low-level dumb components like this Single Pixel component, https://github.com/js-bs/SinglePixel https://github.com/js-bs/SinglePixel , simply wouldn't be possible in regular html templating languages.
- bigpeopleareold 11y agoIn a large application, it starts to become a pain to deal with. It doesn't obviate the need to be careful over mixing responsibilities. In general, React components should just be things that render out to the DOM. If the HTML code is in JS, it doesn't matter as much as the more important thing of separating out your application layers.
- wvenable 11y agoWe abandoned mixing view logic with program logic. It's perfectly reasonable to use PHP as your template engine as long you don't mix your program logic into your templates. React is a view engine; everything done in react is to construct and maintain the view.
- spriggan3 11y agoThe difference is JSX XML syntax is not a templating language but a functional one. In that sense it has nothing to do with PHP templates or any JS templating system based on string templating. it's XML directly in Javascript.
- matt4077 11y agoThere's no escaping the fact that when you have an array of objects, you're going to loop over them to generate html. At that points, it's idiotic to learn some contrived new templating language when you already have .map. Seriously: Separation of Concerns is solved. Yes, you were once far ahead of the pack. But at some point _everybody got it_. It no longer needs a (cumbersome) technical solution because we solved it with education, and developers have been highly disciplines since almost the late 90ies.