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