useLocalStorage

A ref mirrored to localStorage as JSON, with an optional Zod schema: anything that does not parse falls back to the default. A change made in another tab reaches this one through the storage event, checked against the same schema.

Install: pnpm add-composable useLocalStorage

Persistent todo list

Arrays are automatically serialized and deserialized. Add some tasks, check them off, and then refresh the page to see them persist seamlessly.

API