Reputation: 104
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:
Upvotes: 5
Views: 4961
Reputation: 7636
You can suppress this just for the file by placing the following line at the top of the file:
// noinspection JSUnusedGlobalSymbols
Upvotes: 1
Reputation: 4545
You can disable this inspection in webstorm by going to Preferences > Editor > Inspections > Unused symbols
and unchecking Unused global symbol
Upvotes: 0