import { useContext } from 'react'; import { ToolbarCollectionContext } from '../components/ToolbarCollectionContext'; import type { Filter } from '@wix/bex-core'; export interface FilterToolbarState { getPendingFilter(filter: A): A | Filter; } const fallbackState: FilterToolbarState = { getPendingFilter: (filter) => filter, }; export function useFilterToolbarState(): FilterToolbarState { const value = useContext(ToolbarCollectionContext); if (value == null) { return fallbackState; } return value; }