Description
Describe the bug
I created a typescript template create-react-app by running npx create-react-app --template typescript
and tried to import
useEffect and useState. After I import and save file, I got an error: Could not find a declaration file for module 'react'
Did you try recovering your dependencies?
6.14.6
Environment
current version of create-react-app: 4.0.0
running from /Users/healer/.npm/_npx/25783/lib/node_modules/create-react-app
System:
OS: macOS High Sierra 10.13.6
CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
Binaries:
Node: 10.22.1 - ~/.nvm/versions/node/v10.22.1/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.6 - ~/.nvm/versions/node/v10.22.1/bin/npm
Browsers:
Chrome: 86.0.4240.111
Edge: 86.0.622.51
Firefox: 81.0.2
Safari: 13.0.5
npmPackages:
react: ^17.0.1 => 17.0.1
react-dom: ^17.0.1 => 17.0.1
react-scripts: 4.0.0 => 4.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
- run
npx create-react-app --template typescript
- open App.tsx and import useEffect and/or useState
import React, { useEffect, useState } from 'react'
- save file and refresh
Actual behavior
I got error and couldn't run the project.