Controls how JSX constructs are emitted in JavaScript files. This only affects output of JS files that started in .tsx
files.
react
: Emit.js
files with JSX changed to the equivalentReact.createElement
callsreact-jsx
: Emit.js
files with the JSX changed to_jsx
callsreact-jsxdev
: Emit.js
files with the JSX changed to_jsx
callspreserve
: Emit.jsx
files with the JSX unchangedreact-native
: Emit.js
files with the JSX unchanged
For example
This sample code:
tsx
export const HelloWorld = () => <h1>Hello world</h1>;
export const HelloWorld = () => <h1>Hello world</h1>;
Default: "react"
tsx
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
export const HelloWorld = () => <h1>Hello world</h1>;
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
export const HelloWorld = () => <h1>Hello world</h1>;
Preserve: "preserve"
tsx
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
// @jsx: preserve
export const HelloWorld = () => <h1>Hello world</h1>;
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
// @jsx: preserve
export const HelloWorld = () => <h1>Hello world</h1>;
React Native: "react-native"
tsx
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
// @jsx: react-native
export const HelloWorld = () => <h1>Hello world</h1>;
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
// @jsx: react-native
export const HelloWorld = () => <h1>Hello world</h1>;
React 17 transform: "react-jsx"
[1]
tsx
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
// @jsx: react-jsx
export const HelloWorld = () => <h1>Hello world</h1>;
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
// @jsx: react-jsx
export const HelloWorld = () => <h1>Hello world</h1>;
React 17 dev transform: "react-jsxdev"
[1]
tsx
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
// @jsx: react-jsxdev
export const HelloWorld = () => <h1>Hello world</h1>;
declare module JSX {
interface Element {}
interface IntrinsicElements {
[s: string]: any;
}
}
// @showEmit
// @noErrors
// @jsx: react-jsxdev
export const HelloWorld = () => <h1>Hello world</h1>;