teableio/teable

View on GitHub
packages/sdk/src/hooks/use-table.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { useContext } from 'react';
import { AnchorContext, TableContext } from '../context';

export function useTable() {
  const { tableId } = useContext(AnchorContext);
  const { tables } = useContext(TableContext);

  return tables.find((table) => table.id === tableId);
}