5

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

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Deepak Adhana
  • 104
  • 1
  • 8

3 Answers3

4

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

lena
  • 90,154
  • 11
  • 145
  • 150
1

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

// noinspection JSUnusedGlobalSymbols

magritte
  • 7,396
  • 10
  • 59
  • 79
0

You can disable this inspection in webstorm by going to Preferences > Editor > Inspections > Unused symbols and unchecking Unused global symbol

Joshua Craven
  • 4,407
  • 1
  • 31
  • 39