Avatar ·

Error "React refers to a UMD global" in TypeScript with React

Hi everyone! I'm new to TypeScript and React. I created a project using create-react-app with the TypeScript template, but when trying to write a simple component, I encountered a strange error. Here's my code (App.tsx file): ```tsx import React from 'react'; import ReactDOM from 'react-dom'; const App: React.FC = () => { return

Hello World

; }; ReactDOM.render(, document.getElementById('root')); ``` TypeScript gives an error on the line with `import React from 'react'`: "'React' refers to a UMD global, but the current file is a module. Consider adding an import instead." I'm confused. It seems like I'm already using import, but the compiler says I need to add an import. I tried reinstalling dependencies, deleting node_modules and package-lock.json — it didn't help. I'm us