Skip to content

Commit

Permalink
docs: review basic usage docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding authored Jan 27, 2025
1 parent 88e402a commit cbce2c9
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,39 @@ Refer to the **[Docs - Quick Start](https://ghiscoding.gitbook.io/slickgrid-reac
### NPM Package
[slickgrid-react on NPM](https://www.npmjs.com/package/slickgrid-react)


#### Basic Usage

```tsx
import { type Column, type GridOption, SlickgridReact } from 'slickgrid-react';

export default function Example() {
const [dataset] = useState(getData());

const columnDefinitions: Column[] = [
{ id: 'firstName', name: 'First Name', field: 'firstName'},
{ id: 'lastName', name: 'Last Name', field: 'lastName'},
{ id: 'age', name: 'Age', field: 'age' }
]);
const gridOptions: GridOption = { /*...*/ }); // optional grid options

function getData() {
return [
{ id: 1, firstName: 'John', lastName: 'Doe', age: 20 },
{ id: 2, firstName: 'Jane', lastName: 'Smith', age: 21 }
];
}

return (
<SlickgridReact gridId="grid1"
columnDefinitions={columnDefinitions}
gridOptions={gridOptions}
dataset={dataset}
/>
);
}
```

### Troubleshooting

This project **does not** work well with `React.StrictMode`, so please make sure to disable it to avoid pulling your hair for days.
Expand Down

0 comments on commit cbce2c9

Please sign in to comment.