Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESLint warning; defined but never used for react-native components [duplicate]

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,

like image 748
Rajan Maharjan Avatar asked Feb 04 '18 07:02

Rajan Maharjan


1 Answers

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

like image 117
Rajan Maharjan Avatar answered Oct 22 '22 18:10

Rajan Maharjan