Proposal for Standardized JSX

3 days ago 2

There has been no push for JSX standardization.

Partly this seems to be because everyone is fine with status quo.

But JSX has proven immensely practical and will eventually be standardized.

Current JSX transformations are bad

It's obvious why the initial global-based solution is bad, so I won't go into that.

But the import-based solution is equally unfit for standardization:

  • What path should it use?
  • How would it work without tooling?
  • It doesn't allow multiple implementations per file.

The status quo for JSX assumes tooling, and inherently forfeits a path to standardization.

Simple Proposal

JSX expressions are transformed into JS object literal expressions:

  • Tag is placed under Symbol.for("JSX").
  • All children are placed in a "children" field.
  • All other properties remain as-is.

Live Demo

Benefits

  1. Extremely simple
  2. Plain JS objects
  3. No globals
  4. No auto-imports
  5. No pragmas
  6. Supports framework interop
  7. Easy to implement
Read Entire Article