-
Notifications
You must be signed in to change notification settings - Fork 49.8k
Closed
Labels
Component: React CompilerStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
React version: 19.0.0-beta-26f2496093-20240514
Steps To Reproduce
Link to code example:
Input Code
'use client';
function Comp() {
return (
<div aria-label="我能吞下玻璃而不伤身体">
我能吞下玻璃而不伤身体
</div>
)
}React Compiler Output
function Comp() {
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = (
<div aria-label="\u6211\u80FD\u541E\u4E0B\u73BB\u7483\u800C\u4E0D\u4F24\u8EAB\u4F53">
我能吞下玻璃而不伤身体
</div>
);
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}Babel / SWC / ESBuild JSX transform
SWC:
"use client";
import { jsx as _jsx } from "react/jsx-runtime";
function Comp() {
var $ = _c(1);
var t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = _jsx("div", {
"aria-label": "\\u6211\\u80FD\\u541E\\u4E0B\\u73BB\\u7483\\u800C\\u4E0D\\u4F24\\u8EAB\\u4F53",
children: "我能吞下玻璃而不伤身体"
});
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}Babel:
"use strict";
'use client';
var _jsxRuntime = require("react/jsx-runtime");
function Comp() {
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
"aria-label": "\\u6211\\u80FD\\u541E\\u4E0B\\u73BB\\u7483\\u800C\\u4E0D\\u4F24\\u8EAB\\u4F53",
children: "\u6211\u80FD\u541E\u4E0B\u73BB\u7483\u800C\u4E0D\u4F24\u8EAB\u4F53"
});
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}ESBuild:
'use client'
import { jsx } from "react/jsx-runtime";
function Comp() {
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = /* @__PURE__ */ jsx("div", { "aria-label": "\\u6211\\u80FD\\u541E\\u4E0B\\u73BB\\u7483\\u800C\\u4E0D\\u4F24\\u8EAB\\u4F53", children: "\u6211\u80FD\u541E\u4E0B\u73BB\u7483\u800C\u4E0D\u4F24\u8EAB\u4F53" });
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}The current behavior
The prop value becomes double escaped.
The expected behavior
The prop value should only be escaped once.
zce
Metadata
Metadata
Assignees
Labels
Component: React CompilerStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug