()
| 5 | export const DashboardContext = createContext<User | undefined>(undefined); |
| 6 | |
| 7 | export function useUserContext() { |
| 8 | const user = useContext(DashboardContext); |
| 9 | |
| 10 | if (user === undefined) { |
| 11 | throw new Error('useUserContext must be used with a DashboardContext'); |
| 12 | } |
| 13 | |
| 14 | return user; |
| 15 | } |