teableio/teable

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

Summary

Maintainability
A
0 mins
Test Coverage
import { noop } from 'lodash';
import { useContext } from 'react';
import { SearchContext } from '../context/query';

export function useSearch() {
  const search = useContext(SearchContext);

  return {
    ...search,
    setFieldId: search.setFieldId || noop,
    setValue: search.setValue || noop,
    reset: search.reset || noop,
  };
}