-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore prefix in useId() when it is falsey (#21848)
* Ignore prefix in useId() when it is falsey. This commit updates the useId() hook to ignore the `prefix` param in the returned id when `prefix` is falsey. Previously `prefix` was always concatenated into the returned id string but its default value is `undefined` so this would result in IDs like "undefined123". After this change useId() returns IDs like "123" when `prefix` is falsey. * Change files * Update packages/react-utilities/src/hooks/useId.ts Co-authored-by: ling1726 <[email protected]> * Provide default value to useId() prefix Sets the default value of useId()'s first argument, prefix, to "fui-". Co-authored-by: ling1726 <[email protected]>
- Loading branch information
Showing
3 changed files
with
22 additions
and
3 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-utilities-570f1a73-95a2-4590-a3dc-8991afafbad4.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Ignore prefix in useId() when it is falsey.", | ||
"packageName": "@fluentui/react-utilities", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters