JSX cannot be parsed Follow
I have a web-project with severl React JS files in it. Those files cannot be read / parsed / whatever by Phpstorm.
Project JS version is set to be JSX, but it seems the files are not read as JSX.
React lib installed.
Creating a new project did not help either.
Any help please?
Please sign in to leave a comment.
> Those files cannot be read / parsed / whatever by Phpstorm.
Could you please elaborate or attach a screenshot?
Please note all the red highlights and totally wrong parsing of JSX (at the bottom). The code is fine, compiles and works.
Could you please read the warning message on a red highlight?
Also, I am wondering -- what icon type do you see for this file in editor tab title and what does the "Editor | File Types > React JSX" contain for the registered pattern?
The errors differ, looks like the editor cannot understand the language, i.e
The icons I see for the files are JS icons; as for the pattern, it's JSX
however, the files actually are .js. Do you think renaming them will fix the issue?
same as https://intellij-support.jetbrains.com/hc/en-us/community/posts/360002840580/comments/360001006759
>Do you think renaming them will fix the issue?
yes, renaming files to .jsx will likely fix the issue, as they won't depend on chosen language version then and will always be treated as JSX files
renamed the files, it indeed fixes most of the issues.