(matches?: UIMatch[])
| 14 | } |
| 15 | |
| 16 | export function useUser(matches?: UIMatch[]): User { |
| 17 | const maybeUser = useOptionalUser(matches); |
| 18 | if (!maybeUser) { |
| 19 | throw new Error( |
| 20 | "No user found in root loader, but user is required by useUser. If user is optional, try useOptionalUser instead." |
| 21 | ); |
| 22 | } |
| 23 | return maybeUser; |
| 24 | } |
| 25 | |
| 26 | export function useUserChanged(callback: (user: User | undefined) => void) { |
| 27 | useChanged(useOptionalUser, callback); |
no test coverage detected
searching dependent graphs…