Home > OS >  VS Code auto-removes the "import React from 'react'" statement
VS Code auto-removes the "import React from 'react'" statement

Time:06-29

I use shift alt o to remove those unused modules I don't need anymore quite often. It worked fine when doing so in the .tsx file before.

But somehow VS Code removes the import React from 'react' statement recently which didn't happen before.

Is it due to some updates of VS Code recently?

I found this setting below, not sure if it's related or not. But neither enabled and disabled status work.

enter image description here

Or any other reason that may cause this issue?

CodePudding user response:

If you are using React v17 then no need to import React from 'react' in order to write JSX. You can read more here react v17

CodePudding user response:

Because the need for adding import React from 'react'; is not need with the latest react update so that it is taken out.

  • Related