9 lines
248 B
JavaScript
9 lines
248 B
JavaScript
globalThis.bitsIdCounter ??= { current: 0 };
|
|
/**
|
|
* Generates a unique ID based on a global counter.
|
|
*/
|
|
export function useId(prefix = "bits") {
|
|
globalThis.bitsIdCounter.current++;
|
|
return `${prefix}-${globalThis.bitsIdCounter.current}`;
|
|
}
|