Components in my ./src/components
folder are imported by VSCode's refactoring keyboard shortcut e.g a component exported from ./src/components/Card/index.tsx
will bring up the option in VSCode: "Import 'Card' from module components/Card
" when used in a .tsx
file. All my components work this way except for two components the "Text", and "Image" components respectively. Are these some kind of reserved name in VSCode that's preventing the automatic addition of the import? Cheers!
CodePudding user response:
It's because Text
and Image
are built-in global objects already, so VSCode doesn't care to provide an option to auto-import.
Below is a playground showing these global objects (clearly defined already):