Por exemplo como salvar a seleção de pageoptions no localstorage.
<DataGrid
getRowId={(row) => row.key}
sx={dataGridStyles}
slots={{ toolbar: GridToolbar }}
disableColumnSelector
disableDensitySelector
disableRowSelectionOnClick
slotProps={{
toolbar: {
showQuickFilter: true,
},
}}
sortModel={sortModel}
onSortModelChange={handleSortModelChange}
rows={rows}
columns={columns}
localeText={dataGridLocaleText}
initialState={{
pagination: { paginationModel: { pageSize: 2 } },
}}
pageSizeOptions={[20, 50, 100]}
/>
</div>
);
};