NuxtN
Nuxt17mo ago
rtrap

Composable and Cross-Request State pollution

The documentation here https://nuxt.com/docs/getting-started/state-management#best-practices tell to not define a ref outside setup and it suggest to use the useState composable. Question: If I write a composable that defines a state with ref at the root of the module, and I use this composable only in the setup of components, shouldn't it be re-executed on every request (and thus avoid pollution issues)?
Nuxt
Nuxt provides powerful state management libraries and the useState composable to create a reactive and SSR-friendly shared state.
Was this page helpful?