import {UserContext} from "./UserContext.ts"; import {useContext} from "react"; import {UserContextType} from "../../types/users.ts"; export function useUser(): undefined| UserContextType { const context = useContext(UserContext); if (!context) { console.error('useUser must be used within a UserProvider'); return undefined; } return context; }