Skip to content

Instantly share code, notes, and snippets.

@denisraslov
Created December 25, 2017 21:14
Show Gist options
  • Save denisraslov/c744892f5506d10ef2873d751b68798e to your computer and use it in GitHub Desktop.
Save denisraslov/c744892f5506d10ef2873d751b68798e to your computer and use it in GitHub Desktop.
import { Grid, Input, Select } from 'react-spreadsheet-grid';
class GridContainer extends React.PureComponent {
constructor(props) {
super(props);
// It is initially not loaded
this.state = {
loaded: false
};
}
loadEmployees(pageNumber) {
// Load an employees array through API
}
componentDidMount() {
// Load the first part of employees
this.page = 0;
this.loadEmployees(this.page).then((employees) => {
this.setState({
employees
});
});
}
render() {
// Show a loader while employees are loading
if (!this.state.loaded) {
return (
<Loader />
);
} else {
return (
<Grid
rows={this.state.employees}
columns={this.state.columns}
/>
);
}
}
}
export default GridContainer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment