Back to Nuxt

NUXT_E7007

docs/errors/e7007.md

4.5.2327 B
Original Source

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

ts
const counter = useState('counter', () => 0)

::read-more{to="/docs/api/composables/use-state"} ::