|
1 | 1 | 'use client' |
2 | 2 | /* eslint-disable @eslint-react/no-context-provider */ |
3 | | -import React, { createContext, use, useMemo } from 'react' |
| 3 | +// eslint-disable-next-line @eslint-react/no-use-context -- intentional useContext for older React support |
| 4 | +import React, { createContext, useContext, useMemo } from 'react' |
4 | 5 | import { createColumnHelper as coreCreateColumnHelper } from '@tanstack/table-core' |
5 | 6 | import { useTable } from './useTable' |
6 | 7 | import { FlexRender } from './FlexRender' |
@@ -674,7 +675,9 @@ export function createTableHook< |
674 | 675 | TFeatures, |
675 | 676 | TData |
676 | 677 | > { |
677 | | - const table = use(TableContext) |
| 678 | + // useContext used for React 18 compatibility - use() requires React 19+ |
| 679 | + // eslint-disable-next-line @eslint-react/no-use-context -- intentional useContext for older React support |
| 680 | + const table = useContext(TableContext) |
678 | 681 |
|
679 | 682 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition |
680 | 683 | if (!table) { |
@@ -706,7 +709,9 @@ export function createTableHook< |
706 | 709 | * ``` |
707 | 710 | */ |
708 | 711 | function useCellContext<TValue extends CellData = CellData>() { |
709 | | - const cell = use(CellContext) |
| 712 | + // useContext used for React 18 compatibility - use() requires React 19+ |
| 713 | + // eslint-disable-next-line @eslint-react/no-use-context -- intentional useContext for older React support |
| 714 | + const cell = useContext(CellContext) |
710 | 715 |
|
711 | 716 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition |
712 | 717 | if (!cell) { |
@@ -746,7 +751,9 @@ export function createTableHook< |
746 | 751 | * ``` |
747 | 752 | */ |
748 | 753 | function useHeaderContext<TValue extends CellData = CellData>() { |
749 | | - const header = use(HeaderContext) |
| 754 | + // useContext used for React 18 compatibility - use() requires React 19+ |
| 755 | + // eslint-disable-next-line @eslint-react/no-use-context -- intentional useContext for older React support |
| 756 | + const header = useContext(HeaderContext) |
750 | 757 |
|
751 | 758 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition |
752 | 759 | if (!header) { |
|
0 commit comments