每次在React
的{{1}}项目中进行提交或代码检查时,我都会对WebStorm
生命周期方法发出警告:
React
我只能在Warning:Conflicting inherited declaration React.ComponentLifecycle.componentDidMount was found in namespace internal
- >上禁用它们Editor
- > Inspections
- > JavaScrip
- > General
。但这真是个坏主意。
有人有想法我怎么能禁用这个令人发指的警告?
更新即可。上面带有警告消息的代码段:
Duplicate JavaScript declaration
答案 0 :(得分:7)
这似乎只在扩展React.Component
时才会发生。如果您从Component
导入React
并对其进行扩展,那么警告就会消失。
import React, {Component} from 'react';
class Order extends Component {
...
}