WebStorm inspector throws warning when setting initial React state with ES6
Try setting up code assistance with a TypeScript definition file. I do not mean transition your code to TypeScript. Check out this blog post from JetBrains about the subject:
https://blog.jetbrains.com/webstorm/2015/10/working-with-reactjs-in-webstorm-coding-assistance/
Basically, go into WebStorm's preferences. Down in: Languages & Frameworks > JavaScript > Libraries
click the Download
button. Search for React
(and whatever else is in that list that could help), then click Download & Install
. This should help remove some of those ugly warnings.
Now, if only WebStorm would be able to apply PropTypes to the props
object, we'd be able to get those "unresolved variable/functions/method" warnings to go away.
This is a known issue.
The bug has been fixed in version 2016.2 (see: https://youtrack.jetbrains.com/issue/WEB-20884).
As soon as this update lands, this.state
, this.props
and other currently unresolved variables will be resolved.
You need to add props into your constructor
constructor(props) {super(props);