Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4] TypeScript error: 'React' refers to a UMD global, but the current file is a module. Consider adding an import instead. #9901

Closed
nikitowsky opened this issue Oct 24, 2020 · 3 comments

Comments

@nikitowsky
Copy link

Getting this TypeScript error when I delete React import statement.

/Users/nikita/Projects.localized/react-17-test/src/App.tsx
TypeScript error in /Users/nikita/Projects.localized/react-17-test/src/App.tsx(2,11):
'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.  TS2686

    1 | const App = () => {
  > 2 |   return <div>Test</div>;
      |           ^
    3 | };
    4 | 
    5 | export default App;

Just generated project with yarn create react-app react-17-test --template typescript.

@nikitowsky
Copy link
Author

Okay, nevermind, it will work normally with TypeScript 4.1https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#jsx-factories

@missgentle
Copy link

  • import React from 'react';

@ahmad2smile
Copy link

  • import React from 'react';

So we don't get that JSX Transform?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants