useRoute()

useRoute() returns the current normalized Horn route location.

const route = useRoute()

Useful fields

  • path
  • fullPath
  • params
  • query
  • hash
  • matched

Notes

  • path is the concrete current pathname
  • matched contains the active matched route records
  • route ids inside matched come from generated Horn route registries

Use useRoute() when you need read-only route state inside components.