3 ms·
Why does React use JSX when it could be all JavaScript and JSON? My guess is that XML is good for situations where text and data is mixed.
by s3000 4y ago
Why does React use JSX when it could be all JavaScript and JSON?
My guess is that XML is good for situations where text and data is mixed.
- kaoD 4y agoNamed closing tags are good when manually writing stuff because it reduces the opportunity for errors.
- alpaca128 4y agoWhat advantage does that have compared to simple bracket highlighting and indentation? Editors can easily highlight mismatched parentheses, they are however rarely smart enough to auto-close XML tag pairs. I just see it as unnecessary clutter. Meanwhile the only issue I have with JSON is the lack of support for trailing commas.
- postalrat 4y agoNamed closing tags are another confirmation when inserting stuff at the end. I think multiple different confirmations can be easier to recognize than a single one.
- 8n4vidtmkvmk 4y agobecause separating attributes and child elements is actually useful in that context. better matches the Dom. and we need the power of js to do stuffs.
- simplotek 4y ago> My guess is that XML is good for situations where text and data is mixed. I don't agree. My take is that HTML/XML-like syntaxes benefit from familiarity from front-end developers, and a DSL to express document/component trees ends up simplifying the job of expressing document/component trees.
- postalrat 4y ago"a DSL"... like HTML? Or do you have one in mind you feel is better.