File size: 486 Bytes
a44a6ec
 
 
 
 
 
 
 
 
 
2e179f3
a44a6ec
 
 
2e179f3
a44a6ec
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { useContext } from 'react';
import { TabVisibilityContext } from './context';
import { TabVisibilityContextType } from './types';

/**
 * Custom hook to access the tab visibility context
 * @returns The tab visibility context
 */
export const useTabVisibility = (): TabVisibilityContextType => {
  const context = useContext(TabVisibilityContext);

  if (!context) {
    throw new Error('useTabVisibility must be used within a TabVisibilityProvider');
  }

  return context;
};