MCPcopy Create free account
hub / github.com/cosdensolutions/code / useUserContext

Function useUserContext

videos/long/learn-react-hooks-useContext/context.ts:7–15  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5export const DashboardContext = createContext<User | undefined>(undefined);
6
7export 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}

Callers 2

SidebarFunction · 0.90
ProfileFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected