UNPKG

dimsee

Version:

Modern, flexible authentication solution for MERN applications with OAuth support

11 lines 341 B
// frontend/hooks/useAuth.js - Auth Hook import { useContext } from 'react'; import { AuthContext } from '../context/AuthContext'; var useAuth = function useAuth() { var context = useContext(AuthContext); if (!context) { throw new Error('useAuth must be used within an AuthProvider'); } return context; }; export default useAuth;