Returns a string that represents the current pathname.
It takes no arguments and will update every time the route changes.
import { usePathname } from 'one'
export default function CurrentPath() {
const pathname = usePathname()
// Returns e.g. "/blog/hello-world"
return <Text>Current path: {pathname}</Text>
}
Edit this page on GitHub.