3 ms·
What does <foo children={qux}>bla</foo> do?
by pwdisswordfishz 1y ago
What does <foo children={qux}>bla</foo> do?
- 90s_dev 1y agoThis is a known ambiguity in JSX, to the point where TypeScript gives this error: > 'children' are specified twice. The attribute named 'children' will be overwritten. ts(2710)
- pwdisswordfishz 1y agoNo, that's an ambiguity in React. JSX defines only syntax.
- 90s_dev 1y agoTrue. Then can you suggest a standardized ECMAScript JSX proposal that doesn't turn this into a "children" key on an object? Would you just transform it into an array? ["foo", { bar: qux }, "baz"] ?
- WorldMaker 1y agoThat array does better match the current function parameters, so would be a simpler proposal to existing transpilers.
- 90s_dev 1y agoYeah it seems fine. I wouldn't be strongly opposed to it. Standardization of either is better than nothing.