# useStoreId

Signature
`useStoreId(): string`

valdres-react
Identify the nearest store

Returns the id of the nearest `<Provider>`'s store. Useful for debugging nested providers and scopes, or keying things per store. Throws if there is no `<Provider>` above.

## Usage

```tsx
import { useStoreId } from "valdres-react"

function DebugBadge() {
    const id = useStoreId()
    return <span>store: {id}</span>
}
```

## See also

- [useStore](https://valdres.dev/react/useStore) — access the store itself
- [Provider](https://valdres.dev/react/Provider) — provide a store to the tree
