5

It shows defined but never used for imported components; even though the very component is used. How do ignore this eslint warning?

Eg:

import { Provider } from 'react-redux';

....

and added inside render function

render(){
<Provider store={appStore}>
 ......
</Provider>
}

It show's Provider is defined but not used. Any help will be appreciated. Thanks,

Rajan Maharjan
  • 4,398
  • 2
  • 16
  • 26

1 Answers1

14

I've finally fixed it here is the solution;

first, install the eslint-plugin-react and make changes in your .eslintrc.json file.

 {
...
"extends": [
        "eslint:recommended",
        "plugin:react/recommended"
    ],
...
}

Solution source: https://github.com/babel/babel-eslint/issues/6

Rajan Maharjan
  • 4,398
  • 2
  • 16
  • 26