How to access useLocalStorage in Nuxt 3?
I know some Vue Use things come built-in like
useHead
and what not. But does it also come with useLocalStorage? If not, how to add it?3 Replies
VueUse has a composable called
useLocalStorage
https://vueuse.org/core/useLocalStorage/
naturally that will work client-side only
check out this article too
https://lk4real.medium.com/working-with-localstorage-in-nuxt-3-c27618ab89bdDoes that mean I need to install all of VueUse for this to work?
no, its treeshakable, you import the composable you need, in a production build only that composable code will be used
but you do need to install VueUse as a dependency in your project