Skip to content

Commit 8417ff5

Browse files
eps1lonSebastian Silbermann
andauthored
Update compilerOptions.jsx to reflect latest preferences (#2994)
Co-authored-by: Sebastian Silbermann <sebastian.silbermann@klarna.com>
1 parent 309e3e3 commit 8417ff5

File tree

1 file changed

+13
-12
lines changed
  • packages/tsconfig-reference/copy/en/options

1 file changed

+13
-12
lines changed

packages/tsconfig-reference/copy/en/options/jsx.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ oneline: "Specify what JSX code is generated."
66
Controls how JSX constructs are emitted in JavaScript files.
77
This only affects output of JS files that started in `.tsx` files.
88

9-
- `react`: Emit `.js` files with JSX changed to the equivalent `React.createElement` calls
10-
- `react-jsx`: Emit `.js` files with the JSX changed to `_jsx` calls
11-
- `react-jsxdev`: Emit `.js` files with the JSX changed to `_jsx` calls
9+
- `react-jsx`: Emit `.js` files with the JSX changed to `_jsx` calls optimized for production
10+
- `react-jsxdev`: Emit `.js` files with the JSX changed to `_jsx` calls for development only
1211
- `preserve`: Emit `.jsx` files with the JSX unchanged
1312
- `react-native`: Emit `.js` files with the JSX unchanged
13+
- `react`: Emit `.js` files with JSX changed to the equivalent `React.createElement` calls
1414

1515
### For example
1616

@@ -20,7 +20,7 @@ This sample code:
2020
export const HelloWorld = () => <h1>Hello world</h1>;
2121
```
2222

23-
Default: `"react"`
23+
React: `"react-jsx"`<sup>[[1]](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)</sup>
2424

2525
```tsx twoslash
2626
declare module JSX {
@@ -31,10 +31,11 @@ declare module JSX {
3131
}
3232
// @showEmit
3333
// @noErrors
34+
// @jsx: react-jsx
3435
export const HelloWorld = () => <h1>Hello world</h1>;
3536
```
3637

37-
Preserve: `"preserve"`
38+
React dev transform: `"react-jsxdev"`<sup>[[1]](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)</sup>
3839

3940
```tsx twoslash
4041
declare module JSX {
@@ -45,11 +46,11 @@ declare module JSX {
4546
}
4647
// @showEmit
4748
// @noErrors
48-
// @jsx: preserve
49+
// @jsx: react-jsxdev
4950
export const HelloWorld = () => <h1>Hello world</h1>;
5051
```
5152

52-
React Native: `"react-native"`
53+
Preserve: `"preserve"`
5354

5455
```tsx twoslash
5556
declare module JSX {
@@ -60,11 +61,11 @@ declare module JSX {
6061
}
6162
// @showEmit
6263
// @noErrors
63-
// @jsx: react-native
64+
// @jsx: preserve
6465
export const HelloWorld = () => <h1>Hello world</h1>;
6566
```
6667

67-
React 17 transform: `"react-jsx"`<sup>[[1]](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)</sup>
68+
React Native: `"react-native"`
6869

6970
```tsx twoslash
7071
declare module JSX {
@@ -75,11 +76,12 @@ declare module JSX {
7576
}
7677
// @showEmit
7778
// @noErrors
78-
// @jsx: react-jsx
79+
// @jsx: react-native
7980
export const HelloWorld = () => <h1>Hello world</h1>;
8081
```
8182

82-
React 17 dev transform: `"react-jsxdev"`<sup>[[1]](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)</sup>
83+
84+
Legacy React runtime: `"react"`
8385

8486
```tsx twoslash
8587
declare module JSX {
@@ -90,6 +92,5 @@ declare module JSX {
9092
}
9193
// @showEmit
9294
// @noErrors
93-
// @jsx: react-jsxdev
9495
export const HelloWorld = () => <h1>Hello world</h1>;
9596
```

0 commit comments

Comments
 (0)