Saltearse al contenido

useLocation

useLocation() retorna:

{
pathname: string;
search: string;
hash: string;
fullPath: string;
}
import { useLocation } from '@arielgonzaguer/michi-router/core';
function DebugLocation() {
const location = useLocation();
return (
<pre>
{JSON.stringify(location, null, 2)}
</pre>
);
}

Útil para:

  • leer query params (location.search)
  • detectar hash (location.hash)
  • renderizar breadcrumbs simples