<Stack direction="row" spacing={1} sx={{ mb: 1 }}>
  <Button size="small" onClick={removeRow}>
    Remove a row
  </Button>
  <Button size="small" onClick={addRow}>
    Add a row
  </Button>
</Stack>
<DataGrid
  autoHeight
  {...data}
  loading={loading}
  rows={data.rows.slice(0, nbRows)}
/>