'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.
Answered
Singapura posted this in #help-forum
SingapuraOP
I randomly started getting this message overnight on code that was working fine before
it seems the #Unknown Channel is bothering it, but why?
nextjs 14 app router
it seems the #Unknown Channel is bothering it, but why?
nextjs 14 app router
return (
<>Answered by chisto
seems like a bug on recent version, it goes away if you import React at the top or not use fragment
22 Replies
seems like a bug on recent version, it goes away if you import React at the top or not use fragment
Answer
Asiatic Lion
As addition to this. This seems to be bug with typescript 5.7 version. I believe you are able to change Typescript version from VSCode command palette as seen in image. I changed to 5.6.2 (which is on project, and that solved the issue).
@chisto seems like a bug on recent version, it goes away if you import React at the top or not use fragment
Scottish Terrier
Hello Chisto, i have a question about this bug
If i put import react from react at the top
i can get these recommendations
BUT if i dont put it on top, i dont get the recommendations
i can get these recommendations
BUT if i dont put it on top, i dont get the recommendations
Is this also a bug? Is this something version releated?
I used to get these in a regular jsx files, but now i can not?
I've been dealing this issue for the whole day. Is this the issue? A bug?, please help... Thank you.
@Asiatic Lion also would be happy if you can help.
Asiatic Lion
@Scottish Terrier , just confirming but you do have files names
.tsx or .jsx right? That feels like a problem that becomes when VSCode doesn't recognize file as jsxI think i fixed the problem tho @Asiatic Lion
I do not know why, but even in my old projects, some of the projects at least, @types/react is gone and jsconfig files are not recognized
So i had to npm install types react and save the jsconfigs again
and it worked...
Asiatic Lion
Ok, good to hear. That was going to be my next question for checking that
@types/react is installed as dev dependencyBut glad to hear that you got it fixed 👍
@Asiatic Lion But glad to hear that you got it fixed 👍
Scottish Terrier
Thanks! I wonder why it is removed tho?
Asiatic Lion
Hard to tell. Check from git logs what's happened to
package.json in near past?Scottish Terrier
But not only this project, also the other too tho
But i will tho. Thank you so much.
nice it solved, you can mark as solved your post too
@chisto nice it solved, you can mark as solved your post too
Scottish Terrier
Yeah i am trying to solve how to lol