mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-13 16:40:01 +00:00
16 lines
440 B
TypeScript
16 lines
440 B
TypeScript
import { useMatches } from 'react-router-dom';
|
|
|
|
type RouteMetadata = {
|
|
[key: string]: any;
|
|
};
|
|
|
|
/**
|
|
* Returns the `handle` object containing the metadata for the current route,
|
|
* or undefined if the route does not have defined a handle.
|
|
*/
|
|
export function useRouteMetadata(): RouteMetadata | undefined {
|
|
const matches = useMatches();
|
|
const match = matches[matches.length - 1];
|
|
return match?.handle as RouteMetadata | undefined;
|
|
}
|