The useRoute hook provides details about the current route and methods to redirect users to another location.


The base URL including any hash and query parameters, eg /blog/123?foo=bar#trains.


The path of the current URL, eg /blog/123


The hash of the current URL, eg #trains


An object that includes both search params and dynamic route segment values.

Given the page routes/blog/$id.js and the url /blog/123?foo=bar, the params object would look like this:

{ id: '123', foo: 'bar' }

.search(key, value)

Updates search params in the URL. Components will render again with the updated params object.


Performs client-side navigation, adding the new route.


Performs client-side navigation, replacing the current route with the new route.


Navigate to the previous route in the history.


Navigate to the next route in the history.