3 ms·
I hope a future standard will allow multiple elements in expression contexts without the need for fragments, or arrays, e.g. const els = <div/><div/>; Com
by silverwind 1y ago
I hope a future standard will allow multiple elements in expression contexts without the need for fragments, or arrays, e.g.
const els = <div/><div/>;
Compare to current ugly solutions:
const els = <><div/><div/></>;
const els = [<div/>, <div/>];
- eyelidlessness 1y agoMaybe it’s ugly, that seems like a matter of personal taste. But it’s syntactically unambiguous which is valuable especially for a language which mixes expressions and statements in often very subtle ways. There are also other ambiguities to consider: const trailingIntetpolation = <><div/>{foo}</>; const leading = <>{foo}<div/></>; const bare = <>{foo}</>;
- 90s_dev 1y agoSure and while we're at it why not support `const x = 3 5` also.