INIT
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
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}`;
|
||||
}
|
||||
Reference in New Issue
Block a user