Download react-material-dashboard/src/hooks/use-user.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 360 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-material-dashboard/src/hooks/use-user.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-material-dashboard/src/hooks/use-user.ts
-
curl -L -o use-user.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-material-dashboard/src/hooks/use-user.ts
360 Bytes
| import * as React from 'react'; | |
| import type { UserContextValue } from '@/contexts/user-context'; | |
| import { UserContext } from '@/contexts/user-context'; | |
| export function useUser(): UserContextValue { | |
| const context = React.useContext(UserContext); | |
| if (!context) { | |
| throw new Error('useUser must be used within a UserProvider'); | |
| } | |
| return context; | |
| } | |