We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
"undefined"
useId
1 parent 71b718f commit 5ca88c3Copy full SHA for 5ca88c3
packages/utilities/src/utils/useId.ts
@@ -16,4 +16,14 @@ let idCounter = 0;
16
*
17
* @returns A generated ID that can be passed to accessibility attributes
18
*/
19
-export const useId = (id?: any) => `${useReachId(id)}` || `id:${idCounter++}`;
+export const useId = (id?: any) => {
20
+ let retVal = useReachId(id);
21
+
22
+ if (retVal === undefined || retVal === null) {
23
+ retVal = `id:${idCounter++}`;
24
+ } else {
25
+ retVal = `${retVal}`;
26
+ }
27
28
+ return retVal;
29
+};
0 commit comments