5
我使用WebStorm for React JS,并且我得到了所有道具的“未解决的变量警告”。WebStorm未解决的变量警告
但一切正常没有问题,语言的定义,它的存在。 代码有效,我的应用程序没有任何问题。
这是我里面Languages & Frameworks > JavaScript > Libraries
任何想法如何避免这些警告?
UPDATE
代码示例,其中出现这种情况。首先父组件:
import ExpirationTimer from '../../common/expirationTimer';
export default class ListView extends React.Component {
render(){
const language = this.props.language;
let expirationDate = "Wed May 10 2017 15:58:59 GMT+0200";
return (
<div>
<ExpirationTimer expirationDate={expirationDate} language={language}/>
</div>
)
}
}
其中语言是一个对象{lowestPrice: "Lowest price", mileage: "Mileage", ....}
然后该组件在那里我试图让那些道具,它的工作原理,但我得到警告,他们没有得到解决:
export default class ExpirationTimer extends React.Component {
constructor(props){
super(props);
this.state = {
expirationDate: this.props.expirationDate // Here I get the warning
};
}
render(){
let language = this.props.language; // Here I get the warning
return (
<div>
.....
</div>
);
}
}
你可以粘贴一小段代码,发生这种情况,所以我可以在webstorm中重新创建文件并查看我在我的视图中看到的内容吗? –
看起来像这是一个仍然没有解决的已知问题:( –
对我来说,当我禁用图书馆中“react-definitely typed”的错误消失 – lena