November 2019
Beginner
804 pages
20h 1m
English
TypeScript has built-in support for JSX, through the .tsx file extension. Writing JSX code in TypeScript grants all of the type safety benefits that we are used to.
To enable JSX support in TypeScript, the first step is to enable the jsx option in the compiler configuration file (that is, tsconfig.json). The value associated with that option determines what TypeScript does with the JSX code when it transpiles the files. The different values allowed are preserve, react, and react-native.
By default, projects created using the latest versions of the Create React App tool use the react mode. In that mode, TypeScript will replace JSX code with React.createElement() calls, generating pure JavaScript code.
Read now
Unlock full access