JSX: children which are jsx elements dont need expr container

This commit is contained in:
Joe Savona
2023-03-31 12:32:46 -07:00
parent 4e2ef92779
commit 28e6a974fa
5 changed files with 16 additions and 4 deletions
@@ -955,6 +955,10 @@ function codegenJsxElement(
case "StringLiteral": {
return t.jsxText(value.value);
}
case "JSXElement":
case "JSXFragment": {
return value;
}
default: {
return t.jsxExpressionContainer(value);
}
@@ -31,7 +31,7 @@ function Component(props) {
}
t1 = (
<fbt desc={"Dialog to show to user"}>
Hello {<fbt:param name={"user name"}>{t0}</fbt:param>}
Hello <fbt:param name={"user name"}>{t0}</fbt:param>
</fbt>
);
$[0] = props.name;
@@ -22,7 +22,7 @@ function Component(props) {
if (c_0) {
t0 = (
<fbt desc={"Dialog to show to user"}>
Hello {<fbt:param name={"user name"}>{props.name}</fbt:param>}
Hello <fbt:param name={"user name"}>{props.name}</fbt:param>
</fbt>
);
$[0] = props.name;
@@ -28,7 +28,11 @@ function Component(props) {
if (c_0) {
const x = makeOptionalFunction(props);
t0 = x?.(<div>{<span>{props.text}</span>}</div>);
t0 = x?.(
<div>
<span>{props.text}</span>
</div>
);
$[0] = props;
$[1] = t0;
} else {
@@ -34,7 +34,11 @@ function Component(props) {
t0 = $[1];
}
const onChange = t0;
return <form>{<input onChange={onChange} value={name} />}</form>;
return (
<form>
<input onChange={onChange} value={name} />
</form>
);
}
```