refactor: code refactor
This commit is contained in:
@@ -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};
|
||||
}
|
||||
|
Reference in New Issue
Block a user