import { createContext, useContext } from 'react';

/**
 * Context for sharing state between Tabs container and child components
 */
const TabsContext = createContext(null);
/**
 * Hook to consume TabsContext
 */
const useTabsContext = () => {
    const context = useContext(TabsContext);
    if (!context) {
        throw new Error("Tabs components must be used within a Tabs component");
    }
    return context;
};

export { TabsContext, useTabsContext };
