You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You may reproduce the results above about with this repo.
Why this is a problem
As this issue has mentioned, JSX spread children is a nice feature and is technically possible.
React itself don't want/need this because it want its users to use the key prop to structure an array of JSX node and React will flatten these nested array later, when it structure the JSX tree/VDOM things.
However, that is actually more like an implementation detail, which should not be noticed by those who use JSX without React. It will be great if esbuild allows these syntax.
The text was updated successfully, but these errors were encountered:
Makes sense. Looks like TypeScript's behavior regarding this changed in TypeScript 4.5+, and esbuild should be updated to match this new behavior from the TypeScript compiler.
Basically I want to write something like this:
The problems
And I wish esbuild could turn it to something like:
But that is not the case, esbuild will turn it to something else. I will show it below.
And also, I find it possible when I use TS to translate JSX like this example in TS playground.
More information
Here are some output for esbuild/tsc and tsx/jsx.
Input
The intput is always these code, but with
.tsx
and.jsx
extension.Output1 - .tsx + esbuild
esbuild index.tsx --outfile=esbuild-tsx-output/index.js
Output2 - .tsx + tsc
tsc index.tsx --target es6 --moduleResolution node --jsx react --outdir tsc-tsx-output/
Output3 - .jsx + esbuild
esbuild index.jsx --outfile=esbuild-jsx-output/index.js
Output4 - .jsx + tsc
tsc index.jsx --allowjs --target es6 --moduleResolution node --jsx react --outdir tsc-jsx-output/
You may reproduce the results above about with this repo.
Why this is a problem
As this issue has mentioned, JSX spread children is a nice feature and is technically possible.
React itself don't want/need this because it want its users to use the
key
prop to structure an array of JSX node and React will flatten these nested array later, when it structure the JSX tree/VDOM things.However, that is actually more like an implementation detail, which should not be noticed by those who use JSX without React. It will be great if esbuild allows these syntax.
The text was updated successfully, but these errors were encountered: