How does VScode automatically import packages when typing code

1. The problem to be solved:

When using Navigate in react-router-dom, you need to import the corresponding package

  • Doing repetitive import work is really tiring! ! !

insert image description here

2. Solutions

  1. Download the corresponding plug-inAuto Import
    • as shown below, or Ctrl + shift+Xopen the application

insert image description here

  1. restart vscode
  2. Enter the label name, make sure the capitalization is consistent, and it is completely correct
    • Move to the corresponding item, press Enter to automatically import the package
      insert image description here
      insert image description here

Guess you like

Origin blog.csdn.net/hannah2233/article/details/128054894