website/app/routes/blog/useMatch.ts
2023-05-17 14:31:02 +02:00

13 lines
258 B
TypeScript

import { useMatches } from "@remix-run/react";
export function useMatch() {
const matches = useMatches();
const { handle, ...rest } = matches[matches.length - 1];
if (handle == null) {
throw new Error("Bruh");
}
return { handle, ...rest};
}