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

import { useStoreId } from "valdres-react"

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

See also