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
{{ message }}
Repository navigation
Quick Fix command for missing React component imports does not work without React in the scope even with the new JSX factory enabled in Next.js that makes the React import unnecessary #41466
With the release of the new JSX factories in React with create-react-app I am constantly running into this issue outside of Next.js as well and have to import the default React namespace to enable further code-fixes as described in the initial post even though it should no longer be necessary.
Are there any updates on this issue and when it might be resolved?
Reacted by Guillaume Desforges, zen-ventzi-marinov and Gregorein
Also running into this issue often throughout the day. import React from "react" is no longer needed in react 17 and adding it just feels like tech debt that I'll have to remove later.
Even if the first tooltip option stayed the same import React it would be nice to have a 2nd option below it that allows you to just import the component and skip import React if you want. TY for your consideration.
Reacted by Guillaume Desforges and zen-ventzi-marinov
I believe this was fixed by #41950, which will be released in TypeScript 4.3. That PR is listed as closing #41920 which is a duplicate of this issue. (It's phrased differently but I believe it's the same issue.)
Next.js (which is what this issue was opened about) uses "jsx": "preserve" in its tsconfig so unfortunately that PR doesn't solve this (tested with the 4.3.0-beta release of typescript & stable VS Code).
Reacted by Abboud, Gyllsdorff, Aleksandr Grigorii, Elia Darwish, Peter Ramsay, Celal Demir, n1xx1, Lycolia Rizzim and Samuel Cabral
Reacted by Guillaume Desforges, superbullet, 이영창, Sojin Park, Elia Darwish and Sardorbek
I believe this was fixed by #41950, which will be released in TypeScript 4.3. That PR is listed as closing #41920 which is a duplicate of this issue. (It's phrased differently but I believe it's the same issue.)
Unfortunately, this still persists :(
(typescript@4.3.4)
Reacted by harikrishnan, Lycolia Rizzim, Mike Gillett, Anibal Olivares, Cristian Reyes and Johan Himely Mendoza
Well, I have no idea about this.
But it could help for the users of next.js if we could distinguish do we need global react import.
We may need a new preference like "noGlobalReactInTsx"?
The repository in OP is gone now, and there are conflicting reports about whether or not this is fixed. Can someone please provide a concrete repro we can check on?
Activity
ChristianIvicevic commentedon Feb 24, 2021
With the release of the new JSX factories in React with create-react-app I am constantly running into this issue outside of Next.js as well and have to import the default React namespace to enable further code-fixes as described in the initial post even though it should no longer be necessary.
Are there any updates on this issue and when it might be resolved?
rshaul commentedon Feb 24, 2021
Also running into this issue often throughout the day.
import React from "react"is no longer needed in react 17 and adding it just feels like tech debt that I'll have to remove later.Even if the first tooltip option stayed the same import React it would be nice to have a 2nd option below it that allows you to just import the component and skip import React if you want. TY for your consideration.
billyjanitsch commentedon Apr 9, 2021
I believe this was fixed by #41950, which will be released in TypeScript 4.3. That PR is listed as closing #41920 which is a duplicate of this issue. (It's phrased differently but I believe it's the same issue.)
rshaul commentedon Apr 13, 2021
Next.js (which is what this issue was opened about) uses
"jsx": "preserve"in its tsconfig so unfortunately that PR doesn't solve this (tested with the 4.3.0-beta release of typescript & stable VS Code).Hiroki111 commentedon Jun 28, 2021
Billy Janitsch (@billyjanitsch)
Unfortunately, this still persists :(
(typescript@4.3.4)
Kingwl commentedon Jul 20, 2021
Well, I have no idea about this.
But it could help for the users of next.js if we could distinguish do we need global react import.
We may need a new preference like "noGlobalReactInTsx"?
/cc: Daniel Rosenwasser (@DanielRosenwasser) Ryan Cavanaugh (@RyanCavanaugh)
rshaul commentedon Dec 19, 2021
Using VS Code 1.63.2 and Typescript 4.5.4 and this seems to be fixed now for me using a nextjs 11 project. Thanks guys!
normancapule commentedon Feb 28, 2022
Experienced the same thing in a CRA app. Upgrading my typescript version to 4.4.2 fixed it.
mm-webx commentedon Nov 24, 2022
Still have issue with that with React Native app:
Gregorein commentedon Jan 18, 2024
Bump for the issue, default cra app has this issue.
RyanCavanaugh commentedon Jan 19, 2024
The repository in OP is gone now, and there are conflicting reports about whether or not this is fixed. Can someone please provide a concrete repro we can check on?
RyanCavanaugh commentedon Dec 3, 2025
Closing language service bugs related to the 6.0 implementation. For more information, see #62827