NUXT_E7007

useState init must be a function.

E7007

useState() received a non-function initial value. The initializer must be a function so that it only runs once, on the server, and its result can be serialized into the payload for hydration.

Resolution

const counter = useState('counter', () => 0)
Read more in Docs > API > Composables > Use State.
Was this helpful?