mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-05 01:05:02 -05:00
11 lines
273 B
TypeScript
11 lines
273 B
TypeScript
import { useMatches } from "@remix-run/react";
|
|
import invariant from "tiny-invariant";
|
|
import type { RootLoaderData } from "~/root";
|
|
|
|
export function useUser() {
|
|
const [root] = useMatches();
|
|
invariant(root);
|
|
|
|
return (root.data as RootLoaderData | undefined)?.user;
|
|
}
|