1const apiRef = React.useRef<GridApi>(null);
2
3...
4
5<DataGrid
6 components={{
7 noRowsOverlay: (params) => {
8 if (!apiRef.current) {
9 apiRef.current = params.api.current;
10 }
11 return <div>No rows</div>;
12 }
13 }}
14 {...}
15/>
16