From 9d459a5327c6fb360bfd4a1cf362185e6806510f Mon Sep 17 00:00:00 2001 From: Gethin Webster Date: Thu, 27 Jul 2023 10:09:25 +0200 Subject: [PATCH] Add comment --- src/internal/hooks/use-unique-id/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/internal/hooks/use-unique-id/index.ts b/src/internal/hooks/use-unique-id/index.ts index 7ac3a9017b..18af9cad80 100644 --- a/src/internal/hooks/use-unique-id/index.ts +++ b/src/internal/hooks/use-unique-id/index.ts @@ -14,5 +14,6 @@ const useIdFallback = () => { const useId: typeof useIdFallback = (React as any).useId ?? useIdFallback; export function useUniqueId(prefix?: string) { + // if no prefix provided, add a letter at the beginning to ensure valid HTML id return `${prefix ? prefix : 'i'}` + useId(); }