Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error TS2307: Cannot find module 'react'

Tags:

I am trying to create a component with typescript but I am getting the following error in the terminal yet I already installed react and react-dom using npm.

ERROR in ./main.tsx  error TS2307: Cannot find module 'react'.
like image 478
Sseremba Joseph Avatar asked Nov 16 '16 12:11

Sseremba Joseph


1 Answers

Oooh I see.. Try this

You also need to install the typescript definition files for react. You can do that using npm as shown below

npm install @types/react
like image 133
Edwin Kato Avatar answered Sep 26 '22 15:09

Edwin Kato