refactor: code refactor

This commit is contained in:
Andrea
2023-05-17 14:31:02 +02:00
parent 0df503c3f5
commit 8222a4dfb2
16 changed files with 1738 additions and 1282 deletions

View File

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