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 ?
- 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.
- ‘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
typescript
version of at least version 4.1react
andreact-dom
of at least version 17tsconfig.json
must have ajsx
compilerOption ofreact-jsx
orreact-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