I have a list of 20,000 rows in my database that I am fetching to my table. I have this 20,000 rows stored to a localStorage to improve speed. My issue is, when I am navigating to the page (which contains the 20,000 rows), it lags for few seconds before the page is loaded.
How can I let my page render and wait for the huge data to be fetched ?
PS: getItem function fetches the data and store in array items and stored to localStorage.setItem('my_items') .
Index.js
state: {
items:[],
loading:true;
}
componentDidMount()
{
let items = JSON.parse(localStorage.getItem('my_items'));
if(items)
{
this.setState({
items: items
})
this.setState({ loading: false });
}
else
{
this.getItems();
}
}
return (
{loading &&
<div className="d-flex justify-content-center loader-overlay">
<CircularProgress />
</div>
}
<MuiThemeProvider theme={this.getMuiTheme()}>
<MUIDataTable
title={
}
data={this.state.items.map(item => {
return [
item.name,
item.type
]
})}
columns={columns}
options={options}
/>
</MuiThemeProvider>
);
already paginated in the tableyou mean sorted?useEffect) as the user scrolls down the page.