teableio/teable

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

Summary

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

export function useField(fieldId?: string) {
  const { fields } = useContext(FieldContext);
  return fields.find((field) => field.id === fieldId);
}