Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conflicting inherited declaration warning in WebStorm for React lifecycle methods

Every time on commit or code inspection in my React project in WebStorm i got warnings on React lifecycle methods like that:

Warning:Conflicting inherited declaration React.ComponentLifecycle.componentDidMount was found in namespace internal

I can only disable them on Editor -> Inspections -> JavaScrip -> General -> Duplicate JavaScript declaration. But this is really bad idea.

Is anyone got ideas how i can disable this outrageous warnings?

Update. Code snippet with warning message above:

class Order extends React.Component {
    ...

    componentDidMount() {
      ...
    }
}
like image 791
valex Avatar asked Mar 09 '23 03:03

valex


1 Answers

This seems to happen only when extending React.Component. If you import Component from React and extend that, the warnings go away.

import React, {Component} from 'react';

class Order extends Component {
  ...
}
like image 52
Katre Avatar answered Mar 10 '23 17:03

Katre