https://dev.kronoz.win/r/marzneshin.git
| 1 |
578311c |
Mrdn |
2y ago |
import { OnChangeFn, RowSelectionState } from "@tanstack/react-table" |
| 2 |
7738ec1 |
Mardin |
2y ago |
import { useState } from "react"; |
| 3 |
578311c |
Mrdn |
2y ago |
|
| 4 |
578311c |
Mrdn |
2y ago |
export interface UseRowSelectionReturn { |
| 5 |
578311c |
Mrdn |
2y ago |
setSelectedRow: OnChangeFn<RowSelectionState> |
| 6 |
578311c |
Mrdn |
2y ago |
selectedRow: RowSelectionState |
| 7 |
578311c |
Mrdn |
2y ago |
} |
| 8 |
7738ec1 |
Mardin |
2y ago |
|
| 9 |
7738ec1 |
Mardin |
2y ago |
export const useRowSelection = (state: RowSelectionState): UseRowSelectionReturn => { |
| 10 |
7738ec1 |
Mardin |
2y ago |
const [selectedRow, setSelectedRow] = useState<RowSelectionState>(state) |
| 11 |
7738ec1 |
Mardin |
2y ago |
return { setSelectedRow, selectedRow } |
| 12 |
7738ec1 |
Mardin |
2y ago |
} |
| 13 |
7738ec1 |
Mardin |
2y ago |
|