Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 634 Bytes

use-request-url.md

File metadata and controls

25 lines (18 loc) · 634 Bytes

useRequestURL

useRequestURL is a helper function that returns an URL object working on both server-side and client-side.

::code-group

<script setup>
const url = getRequestURL()
</script>

<template>
  <p>URL is: {{ url }}</p>
  <p>Path is: {{ url.pathname }}</p>
</template>
<p>URL is: http://localhost:3000/about</p>
<p>Path is: /about</p>

::

You can find the list of the URL instance properties on the MDN documentation.