Sometimes, we want to fix cannot use JSX unless the ‘–jsx’ flag is provided issue with TypeScript.
In this article, we’ll look at how to fix cannot use JSX unless the ‘–jsx’ flag is provided issue with TypeScript.
How to fix cannot use JSX unless the ‘–jsx’ flag is provided issue with TypeScript?
To fix cannot use JSX unless the ‘–jsx’ flag is provided issue with TypeScript, we should set the jsx
option to react
.
For instance, we add
{
"compilerOptions": {
"jsx": "react"
}
}
into tsconfig.json
to make the TypeScript compiler compile JSX code.
Conclusion
To fix cannot use JSX unless the ‘–jsx’ flag is provided issue with TypeScript, we should set the jsx
option to react
.