File size: 360 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import * as React from 'react';
import type { UserContextValue } from '@/contexts/user-context';
import { UserContext } from '@/contexts/user-context';
export function useUser(): UserContextValue {
const context = React.useContext(UserContext);
if (!context) {
throw new Error('useUser must be used within a UserProvider');
}
return context;
}
|