Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export default unused in WebStorm

Tags:

I am using loadable in React to load my component dynamically. So I'm exporting the index of each component and import them in app.js. But the issue is I am still getting an error in WebStorm that the export default is unused in individual component index file.

Here is my code. This is in my App.js file.

const HomeIndex = Loadable({
loader: () => import('./components/home/Index'),
loading: () => <div> </div>,
 });

My component index file.

export default class HomeIndex extends React.Component {

fetchCounts = () =>{
    this.counts.fetchCounts();
};

render(){
    return(
        <div className="pageView">
            <Counts ref={refs => { this.counts = refs; }}/>
            <hr/>
            <Customers fetchCounts={this.fetchCounts}/>
        </div>
    )
  }
}

Screenshot of error in WebStorm:

enter image description here

like image 210
Deepak Adhana Avatar asked Feb 14 '19 09:02

Deepak Adhana


2 Answers

Logged as WEB-37294, please vote for it to be notified when it's fixed

like image 75
lena Avatar answered Oct 12 '22 20:10

lena


You can suppress this just for the file by placing the following line at the top of the file:

// noinspection JSUnusedGlobalSymbols

like image 29
magritte Avatar answered Oct 12 '22 22:10

magritte