Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode keeps asking to import React on NextJS and React 17 apps

I've already set the following rules to off in my eslintrc.json file:

enter image description here

But whenever I press ctrl+. to try importing a component from a different file vscode suggests me to import React.

enter image description here

is there any way to stop this from happening?

below are the plugins I'm using with the .eslintrc.json:

enter image description here

like image 505
Aylton Almeida Avatar asked Nov 30 '20 14:11

Aylton Almeida


People also ask

Do I need to import React in Nextjs?

Note: With Next. js you don't need to import React because Next.

How do I enable React Emmet in VS code?

Go to settings > extensions > emmet > include languages and add javascript as the item and javascriptreact as the value.

Does Vscode support React?

React is a popular JavaScript library developed by Facebook for building user interfaces. The Visual Studio Code editor supports React.


1 Answers

This isn't an issue with ESLint - this is an issue with Typescript. It's tracked here and you can confirm that even if you disable ESLint for your project you'll get this error and that bad suggestion. At the moment there's no workaround other but it will hopefully be fixed in TS4.3. I will update this answer if a workaround or solution is released.

like image 95
Zack Avatar answered Oct 28 '22 14:10

Zack