File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ display : " JSX"
3+ oneline : " Controlla come viene emesso JSX"
4+ ---
5+
6+ Controlla come i costrutti JSX vengono emessi in file Javascript. Questo influisce sull'output solo nel caso il file JS termini con ` .tsx ` .
7+
8+ - ` react ` : Genera dei file ` .js ` con JSX modificato nelle chiamate ` React.createElements ` equivalenti.
9+ - ` react-jsx ` : Genera dei file ` .js ` con JSX modificato nelle chiamate ` _jsx ` .
10+ - ` react-jsxdev ` : Genera dei file ` .js ` con JSX modificato in chiamate ` _jsx ` .
11+ - ` preserve ` : Genera dei file ` .jsx ` con JSX invariato.
12+ - ` react-native ` : Genera dei file ` .js ` con JSX invariato.
13+
14+ ### Per esempio
15+
16+ Questo codice esempio:
17+
18+ ``` tsx
19+ export const ciaoMondo = () => <h1 >Ciao mondo</h1 >;
20+ ```
21+
22+ Predefinito: ` "react" `
23+
24+ ``` tsx twoslash
25+ declare module JSX {
26+ interface Element {}
27+ interface IntrinsicElements {
28+ [s : string ]: any ;
29+ }
30+ }
31+ // @showEmit
32+ // @noErrors
33+ export const ciaoMondo = () => <h1 >Ciao mondo</h1 >;
34+ ```
35+
36+ Conservare: ` "preserve" `
37+
38+ ``` tsx twoslash
39+ declare module JSX {
40+ interface Element {}
41+ interface IntrinsicElements {
42+ [s : string ]: any ;
43+ }
44+ }
45+ // @showEmit
46+ // @noErrors
47+ // @jsx: preserve
48+ export const ciaoMondo = () => <h1 >Ciao mondo</h1 >;
49+ ```
50+
51+ React Native: ` "react-native" `
52+
53+ ``` tsx twoslash
54+ declare module JSX {
55+ interface Element {}
56+ interface IntrinsicElements {
57+ [s : string ]: any ;
58+ }
59+ }
60+ // @showEmit
61+ // @noErrors
62+ // @jsx: react-native
63+ export const ciaoMondo = () => <h1 >Ciao mondo</h1 >;
64+ ```
65+
66+ React 17 convertito: ` "react-jsx" ` <sup >[[ 1]] ( https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html ) </sup >
67+
68+ ``` tsx twoslash
69+ declare module JSX {
70+ interface Element {}
71+ interface IntrinsicElements {
72+ [s : string ]: any ;
73+ }
74+ }
75+ // @showEmit
76+ // @noErrors
77+ // @jsx: react-jsx
78+ export const ciaoMondo = () => <h1 >Ciao mondo</h1 >;
79+ ```
80+
81+ React 17 dev convertito: ` "react-jsxdev" ` <sup >[[ 1]] ( https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html ) </sup >
82+
83+ ``` tsx twoslash
84+ declare module JSX {
85+ interface Element {}
86+ interface IntrinsicElements {
87+ [s : string ]: any ;
88+ }
89+ }
90+ // @showEmit
91+ // @noErrors
92+ // @jsx: react-jsxdev
93+ export const ciaoMondo = () => <h1 >Ciao mondo</h1 >;
94+ ```
You can’t perform that action at this time.
0 commit comments