WebStorm/PhpStorm warning for react attributes in jsx like className

后端 未结 4 1152
心在旅途
心在旅途 2021-02-19 01:44

I can not remove following warning in react code. \"Attribute className is not allowed here\".

  • Warning in PhpStorm

  • Unkn
相关标签:
4条回答
  • 2021-02-19 02:08

    Had a similar problem like the asker - after updating to IntelliJ 2016.3, the values of the classNames were marked as errors (not the "className" attribute itself, but it's similar to what he had).

    My solution was to select "Uninject language or reference" from the little lightbulb that appears when you put your cursor on the error:

    Have no idea why it works.

    Couldn't find any decent React/JSX plugins for Intellij either, except from the above mentioned "React-Templates" which did wonders in the past.

    But it seems Intellij's native (I guess) support for JSX & React is not bad, except for annoying things like this.

    0 讨论(0)
  • 2021-02-19 02:16

    I'm a little late on the scene but performing Invalidate Caches/Restart... solved the issue (after switching to JSX Harmony).

    0 讨论(0)
  • 2021-02-19 02:19

    You should add Reactjs library.

    Using Reactjs in JavaScript and TypeScript

    In my case, I've just added Reactjs support for TypeScript:

    0 讨论(0)
  • 2021-02-19 02:23

    My problem with warnings in jsx was solved by instaling React-Template plugin.

    0 讨论(0)
提交回复
热议问题