Skip to content
tinasPublic

About

🚃 Type-safe reactive state for URL and storage

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

Repository files navigation

usewagen

Reactive state for URL and storage in Vue. Type-safe, with the source always in charge.

Documentation lives at usewagen.dev.

Install

pnpm add usewagen

vue is a peer dependency. vue-router is only needed if you use the router composables.

Usage

import { parseAsInteger } from 'usewagen'
import { useRouteState } from 'usewagen/router'
import { useLocalStorage } from 'usewagen/storage'

const page = useRouteState({ key: 'page', parser: parseAsInteger.withDefault(1) })
const theme = useLocalStorage({ key: 'theme' })

page is a Ref<number> over ?page= and theme a Ref<string | null> over the theme entry in localStorage.

License

MIT

About

🚃 Type-safe reactive state for URL and storage

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages