You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With React version 17 it's no longer necessary to import React in order to use JSX. However VS code refuses to automatically import a component that is not in scope and used in JSX. It only shows an option import default 'React' from module 'react'. If I do this, it then shows an option to import the missing component.
This only seems to happen in typescript projects, in javascript there is no quick fixes related to import at all, but I've never worked with javascript projects I don't know if this is supposed to happen.
VSCode Version: 1.53.0-insider
OS Version: Windows 10 2004
Steps to Reproduce:
Create an empty react app using typescript, I tested with npx create-react-app test --template typescript
Create a Test component in test.jsx
Use Test component in App.jsx without importing either Test or React
Test component will have red squiggles, open quick fix on it and see that there is no option
to import Test, only to open React
Now import React and see that importing Test option has appeared
TS Template added by @mjbvz
TypeScript Version: 4.1.2
Search Terms
With React version 17 it's no longer necessary to import
React
in order to use JSX. However VS code refuses to automatically import a component that is not in scope and used in JSX. It only shows an optionimport default 'React' from module 'react'
. If I do this, it then shows an option to import the missing component.This only seems to happen in typescript projects, in javascript there is no quick fixes related to import at all, but I've never worked with javascript projects I don't know if this is supposed to happen.
Steps to Reproduce:
npx create-react-app test --template typescript
Test
component intest.jsx
Test
component inApp.jsx
without importing eitherTest
orReact
Test
component will have red squiggles, open quick fix on it and see that there is no optionto import
Test
, only to openReact
React
and see that importingTest
option has appearedRepo: https://github.com/ialexi-bl/react-vscode-issue-reproduction
Open
App.tsx
and try to quick fix missingTest
importDoes this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: