close

[Solved] ‘React’ refers to a UMD global, but the current file is a module. Consider adding an import instead.ts

Hello Guys, How are you all? Hope You all Are Fine. Today I am facing an error in My reactJs project ‘React’ refers to a UMD global, but the current file is a module. Consider adding an import instead.ts in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ‘React’ refers to a UMD global, but the current file is a module. Consider adding an import instead.ts Error Occurs ?

I am facing following error in my reactjs project.

To Solve 'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.ts

How To Solve ‘React’ refers to a UMD global, but the current file is a module. Consider adding an import instead.ts Error ?

  1. How To Solve ‘React’ refers to a UMD global, but the current file is a module. Consider adding an import instead.ts Error ?

    To Solve ‘React’ refers to a UMD global, but the current file is a module. Consider adding an import instead.ts Here This error message comes from TypeScript compiler. The React 17 new jsx transform is not currently supported in Typescript 4.0, and will be supported in 4.1.

  2. ‘React’ refers to a UMD global, but the current file is a module. Consider adding an import instead.ts

    To Solve ‘React’ refers to a UMD global, but the current file is a module. Consider adding an import instead.ts Here This error message comes from TypeScript compiler. The React 17 new jsx transform is not currently supported in Typescript 4.0, and will be supported in 4.1.

Solution 1

  1. typescript version of at least version 4.1
  2. react and react-dom of at least version 17
  3. tsconfig.json must have a jsx compilerOption of react-jsx or react-jsxdev

example:

// tsconfig.json
{
  "compilerOptions": {
    ...
    "jsx": "react-jsx"
    ...
  },
}

Solution 2

Here This error message comes from TypeScript compiler. The React 17 new jsx transform is not currently supported in Typescript 4.0, and will be supported in 4.1.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment