Saltearse al contenido

Tipos

type NavigateFn = (to: string, options?: NavigateOptions) => void;
interface NavigateOptions {
replace?: boolean;
state?: unknown;
}
OpciónTipoUso recomendado
replacebooleanReemplazar la ruta actual en historial (ej. redirección post-login)
stateunknownAdjuntar metadatos a la navegación en history state
interface Route {
path: string;
component: ReactNode;
}
type RouteParams = Record<string, string>;
interface RouterLocation {
pathname: string;
search: string;
hash: string;
fullPath: string;
}
interface RouterProviderProps {
routes: Route[];
children?: ReactNode;
notFound?: ReactNode;
basename?: string;
layout?: ComponentType<{ children: ReactNode }>;
}
interface AuthState<TUser = unknown> {
user: TUser | null;
isLoading: boolean;
}
interface ProtectedConfig<TUser = unknown> {
states: AuthState<TUser>;
redirectionPath: string;
loadingComponent?: ReactNode;
defaultMessage?: string;
}