import { useEffect, useState } from 'react';
export function useActiveWithFallback(options, activeKey) {
    const activeOption = options.find(({ key }) => key === activeKey);
    const [currentKey, setCurrentKey] = useState(activeOption?.key || options[0]?.key);
    useEffect(() => {
        if (activeOption) {
            setCurrentKey(activeOption.key);
        }
    }, [activeOption]);
    return currentKey;
}
//# sourceMappingURL=useActiveWithFallback.js.map