Typescript - "Cannot find name" errors in React components

Solution 1:

Typescript isn't expecting to see JSX in your Typescript file. The easiest way to resolve this is to rename your file from .ts to .tsx.

JSX in Typescript Documentation

Solution 2:

I have also come across the same problem. This may be due to the extension you use as .ts don't allow to write JSX code in it. Instead using .ts extension you should use .tsx extension