---
title: "clearNuxtState"
description: "Delete the cached state of useState."
canonical_url: "https://nuxt.com/docs/3.x/api/utils/clear-nuxt-state"
---
# clearNuxtState

> Delete the cached state of useState.

<note>

This method is useful if you want to invalidate the state of `useState`.

</note>

## Type

```ts [Signature]
export function clearNuxtState (keys?: string | string[] | ((key: string) => boolean)): void
```

## Parameters

- `keys`: One or an array of keys that are used in [`useState`](https://nuxt.com/docs/3.x/api/composables/use-state) to delete their cached state. If no keys are provided, **all state** will be invalidated.

---

- [Source](https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/state.ts)


## Sitemap

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