Configure JSX Support in TypeScript
We have a simple React component MyComponent
in the file index.tsx
:
// index.tsxconst MyComponent = () => { return <div />; // red squiggly line under <div />};
The MyComponent
constant holds a function that returns a JSX element, which is a way to write HTML within JavaScript
Transcript
00:00 Here we are inside an imaginary React application. We're inside a .tsx file, which is the file extension you need to use when you're creating JSX or using JSX in a file. We have my components here and we have a div. But it says here, cannot use JSX unless
00:17 the JSX flag is provided. Interesting. Your job is to work out how to change the tsconfig.json file that we have here in order to specify that we're using JSX and which JSX option we actually need to choose. Good luck.