by 90s_dev · 1y ago · 0 comments
React used to transform it into React.createElement("foo", { bar: qux }, "bla")
Now it transforms it into import _jsx from "react/jsx-runtime"; _jsx("foo", { bar: qux }, "bla")
My proposal transforms it into { [Symbol.for('jsx')]: 'foo', bar: qux, children: "bla" }
It's self-contained and generic, doesn't rely on auto-imports or globals, and doesn't have key collisions.
It's the only way I can imagine it ever being standardized.
There are a few things missing but jsx is sugar that complicates things for me.
Just teach people function composition. It's easier.
> 'children' are specified twice. The attribute named 'children' will be overwritten. ts(2710)