TS17004

error TS17004: Cannot use JSX unless the ‘–jsx’ flag is provided.

Broken Code ❌

1
2
3
4
5
6
7
8
9
function App() {
return (
<p>
My App!
</p>
);
}

export default App;

Fixed Code ✔️

You have to add a configuration for “jsx” to your “tsconfig.json” file:

tsconfig.json
1
2
3
4
5
{
"compilerOptions": {
"jsx": "react"
}
}