The URL is your state
Bind query params to typed, reactive refs. One source of truth for view state, with no separate ref to keep in sync.
The URL is the single source of truth for view state. Typed, reactive, and bound to your router.
Search, filters, sort, and pagination belong in the query string, where a shared link restores the exact view. vuqs makes that state typed and reactive: you read values back as the types you declared, and write them like any ref.
<script setup lang="ts">
import { codecs, useQueryState } from '@vuqs/core'
const search = useQueryState('q', codecs.string.withDefault(''))
const page = useQueryState('page', codecs.integer.withDefault(1))
</script>
<template>
<input v-model="search" placeholder="Search…">
<button @click="page++">Next page</button>
<p>Searching “{{ search }}” on page {{ page }}</p>
</template>Assigning a param writes the URL; the URL writes it back.
TIP
New here? Start with Installation, then read Concepts for the mental model.