简体   繁体   中英

Do we need import react and react-dom nowadays?

1

Hi,I want to code something about REACT COMPONENT. When I type these two lines in Visual Studio Code:

import React from 'React';
import ReactDOM from 'react-dom'.;

As screenshot shown,VS suggests me to delete these two lines.
Do we no longer need to import 'react' and 'react-dom' nowadays?

2

2 things here:

First, it says to remove because it is an unused import.

Second, to make sure this a React Component, you have to declare the import.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM