security/codeql-dependabot-gitleaks
| 1 | import * as React from "react" |
| 2 | |
| 3 | import { DataTableContext, DataTableContextValue } from "./data-table-context" |
| 4 | |
| 5 | const useDataTableContext = <TData,>(): DataTableContextValue<TData> => { |
| 6 | const context = React.useContext(DataTableContext) |
| 7 | |
| 8 | if (!context) { |
| 9 | throw new Error( |
| 10 | "useDataTableContext must be used within a DataTableContextProvider" |
| 11 | ) |
| 12 | } |
| 13 | |
| 14 | return context |
| 15 | } |
| 16 | |
| 17 | export { useDataTableContext } |