wouter-vue Documentation

useLocation

Get the current location and navigate programmatically.

Description

Returns a tuple [location, navigate] where:

  • location is a reactive Ref<string> containing the current pathname
  • navigate is a function to programmatically change the location

Returns

Example

Navigate Options

The navigate function accepts an optional second parameter:

  • replace: boolean - If true, replaces current history entry instead of adding a new one (default: false)

Built with wouter-vue • GitHub