/ src / hooks / useNWCContext.ts
useNWCContext.ts
 1  import { useContext } from 'react';
 2  import { createContext } from 'react';
 3  import { useNWCInternal } from '@/hooks/useNWC';
 4  
 5  type NWCContextType = ReturnType<typeof useNWCInternal>;
 6  
 7  export const NWCContext = createContext<NWCContextType | null>(null);
 8  
 9  export function useNWC(): NWCContextType {
10    const context = useContext(NWCContext);
11    if (!context) {
12      throw new Error('useNWC must be used within a NWCProvider');
13    }
14    return context;
15  }