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