Skip to content

Commit c7da91b

Browse files
ademtonaynstepien
andauthored
docs(readme): update Quick Start section to reflect named export (#3711)
* docs(readme): update Quick Start section to reflect named export This commit updates README.md Quick Start section to align with current package exports. Remove default export example as the package now uses named export. Signed-off-by: Adem TONAY <ademtonay@gmail.com> * fix other imports * ignore these new lints for now --------- Signed-off-by: Adem TONAY <ademtonay@gmail.com> Co-authored-by: Nicolas Stepien <stepien.nicolas@gmail.com>
1 parent 8cc599a commit c7da91b

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ npm install react-data-grid
6464
```jsx
6565
import 'react-data-grid/lib/styles.css';
6666

67-
import DataGrid from 'react-data-grid';
67+
import { DataGrid } from 'react-data-grid';
6868

6969
const columns = [
7070
{ key: 'id', name: 'ID' },
@@ -114,7 +114,7 @@ An optional array of summary rows, usually used to display total values for exam
114114
A function returning a unique key/identifier per row. `rowKeyGetter` is required for row selection to work.
115115

116116
```tsx
117-
import DataGrid from 'react-data-grid';
117+
import { DataGrid } from 'react-data-grid';
118118

119119
interface Row {
120120
id: number;
@@ -140,7 +140,7 @@ The second parameter is an object with an `indexes` array highlighting which row
140140

141141
```tsx
142142
import { useState } from 'react';
143-
import DataGrid from 'react-data-grid';
143+
import { DataGrid } from 'react-data-grid';
144144

145145
function MyGrid() {
146146
const [rows, setRows] = useState(initialRows);
@@ -181,7 +181,7 @@ A function called when row selection is changed.
181181

182182
```tsx
183183
import { useState } from 'react';
184-
import DataGrid, { SelectColumn } from 'react-data-grid';
184+
import { DataGrid, SelectColumn } from 'react-data-grid';
185185

186186
const rows: readonly Rows[] = [...];
187187

@@ -224,7 +224,7 @@ A function called when sorting is changed
224224

225225
```tsx
226226
import { useState } from 'react';
227-
import DataGrid, { SelectColumn } from 'react-data-grid';
227+
import { DataGrid, SelectColumn } from 'react-data-grid';
228228

229229
const rows: readonly Rows[] = [...];
230230

@@ -422,7 +422,7 @@ interface Renderers<TRow, TSummaryRow> {
422422
For example, the default `<Row />` component can be wrapped via the `renderRow` prop to add contexts or tweak props
423423

424424
```tsx
425-
import DataGrid, { RenderRowProps, Row } from 'react-data-grid';
425+
import { DataGrid, RenderRowProps, Row } from 'react-data-grid';
426426

427427
function myRowRenderer(key: React.Key, props: RenderRowProps<Row>) {
428428
return (
@@ -444,7 +444,7 @@ function MyGrid() {
444444
A function to add a class on the row
445445

446446
```tsx
447-
import DataGrid from 'react-data-grid';
447+
import { DataGrid } from 'react-data-grid';
448448

449449
function MyGrid() {
450450
return <DataGrid columns={columns} rows={rows} rowClass={rowClass} />;

src/DataGrid.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,7 @@ export function DataGrid<R, SR = unknown, K extends Key = Key>(props: DataGridPr
10661066
// Reset the positions if the current values are no longer valid. This can happen if a column or row is removed
10671067
if (selectedPosition.idx > maxColIdx || selectedPosition.rowIdx > maxRowIdx) {
10681068
setSelectedPosition({ idx: -1, rowIdx: minRowIdx - 1, mode: 'SELECT' });
1069+
// eslint-disable-next-line react-compiler/react-compiler
10691070
setDraggedOverRowIdx(undefined);
10701071
}
10711072

@@ -1190,6 +1191,7 @@ export function DataGrid<R, SR = unknown, K extends Key = Key>(props: DataGridPr
11901191
);
11911192
})}
11921193
<RowSelectionChangeContext value={selectRowLatest}>
1194+
{/* eslint-disable-next-line react-compiler/react-compiler */}
11931195
{getViewportRows()}
11941196
</RowSelectionChangeContext>
11951197
{bottomSummaryRows?.map((row, rowIdx) => {

0 commit comments

Comments
 (0)