Categories
TypeScript Answers

How to fix cannot use JSX unless the ‘–jsx’ flag is provided issue with TypeScript?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *