6 ms·
It starts to sound like browsers should support JSX natively...
by trm42 10y ago
It starts to sound like browsers should support JSX natively...
- pjmlp 10y agoBrowsers should have kept doing just plain HTML/CSS, or have adopted XHTML with the accompanying standards that would have allowed for a XUL / XAML like experience. Instead, it's hack on top of hack.
- rounce 10y agoWell, there's this thing called HTML...
- jakelazaroff 10y agoI think it's pretty clear that HTML alone is not sufficient for creating the types of web applications we are today — otherwise, no one would have bothered to create or adopt React/Angular/web components in the first place.
- AshleysBrain 10y agoTemplate strings look like a better way to do JSX, imo: why can't html`<p>Hello world</p>` be made to return the DOM element for the p tag?
- dmitriid 10y agoJSX appeared before template strings where even an idea (I think :) ). The thing though, JSX doesn't return DOM elements. It's a very thin DSL on top of React.createElement calls. Since it's Javascript all the way down, you get a number of benefits: - you are not constrained by limitations such as "attributes can only be strings" or "children can only be DOM Elements". It's all Javascript expressions - React knows the return value. It can do efficient diff'ing against its internal DOM representations and only update the actual DOM as needed (same goes for other virtual dom implementations such as snabbdom, virtual-dom etc.)
- kybernetikos 10y agoFirefox supported embedded xml for years (e4x) but took it out. Jsx feels a little bit similar.
- dmitriid 10y agoHTML Components (1998) was proposed and implemented by Microsoft starting in IE5.5 (obsoleted in IE10). XBL (2001) and its successor XBL2 (2007) was proposed by Mozilla as a companion to their XUL user-interface language https://blogs.windows.com/msedgedev/2015/07/14/bringing-componentization-to-the-web-an-overview-of-web-components/ https://blogs.windows.com/msedgedev/2015/07/14/bringing-comp...
- dmitriid 10y agoBetter DOM APIs, surely. It could be anything from JSX to https://github.com/Matt-Esch/virtual-dom/tree/master/virtual-hyperscript https://github.com/Matt-Esch/virtual-dom/tree/master/virtual.... When all you can pass to an attribute is a string, it's very hard to seriously talk about useful extensible custom components on the web :)
- spankalee 10y agoProperties and children have you heard of them? Here's the docs for an element that has some arbitrarily complex properties and function-values properties, that you can set from plain JS or Polymer's template syntax or Angular's, etc... https://www.polymer-project.org/2.0/docs/api/elements/Polymer.DomRepeat https://www.polymer-project.org/2.0/docs/api/elements/Polyme... It also takes a template and stamps it out several times based on the complex data, like "higher-order components". It's very hard to seriously talk about web components with someone so willfully ignorant about them.
- dmitriid 10y agoI've heard about them. I also included an example in my article specifically about children. DOM APIs are a much bigger problem than just WCs, but are a part of the WC's problem as well
- iLemming 10y agoJSX in 201x is like new XML of 200's. I've seen webpack.configs written in JSX. WTF is wrong with people?