---
title: "NUXT_E7007"
description: "useState init must be a function."
canonical_url: "https://nuxt.com/docs/4.x/errors/e7007"
---
# 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="https://nuxt.com/docs/4.x/api/composables/use-state">



</read-more>


## Sitemap

See the full [sitemap](https://nuxt.com/sitemap.md) for all pages.
