1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
//// [file.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
declare var React: any;
<div>Dot goes here: · ¬AnEntity; </div>;
<div>Be careful of "-ed strings!</div>;
<div>{{braces}}</div>;
// Escapes do nothing
<div>\n</div>;
// Also works in string literal attributes
<div attr="{…}\"></div>;
// Does not happen for a string literal that happens to be inside an attribute (and escapes then work)
<div attr={"{…}\""}></div>;
// Preserves single quotes
<div attr='"'></div>
//// [file.js]
React.createElement("div", null, "Dot goes here: \u00B7 ¬AnEntity; ");
React.createElement("div", null, "Be careful of \"-ed strings!");
React.createElement("div", null, "{{braces}}");
// Escapes do nothing
React.createElement("div", null, "\\n");
// Also works in string literal attributes
React.createElement("div", { attr: "{\u2026}\\" });
// Does not happen for a string literal that happens to be inside an attribute (and escapes then work)
React.createElement("div", { attr: "{…}\"" });
// Preserves single quotes
React.createElement("div", { attr: '"' });
|