import { createContext, useContext } from 'react'; /* * The context object and its hook live here, apart from AuthContext.jsx. * * That split is what React Fast Refresh needs: a module that exports a * component alongside non-component values cannot be hot-swapped, so every * edit to the provider would remount the whole tree and drop the session you * were testing with. AuthContext.jsx now exports only , and the * hook everything imports lives in this plain module. */ export const AuthContext = createContext(null); export function useAuth() { const context = useContext(AuthContext); if (!context) { throw new Error('useAuth must be used within an AuthProvider'); } return context; }