Skip to content

Commit 726670e

Browse files
committed
fix(useElementIds): improve fix for webpack analyzer
1 parent 9e79c4e commit 726670e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/hooks/useTagGroup/utils/useElementIds.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ type UseElementIdsReturnValue = {
1313
getTagId: (index: number) => string
1414
}
1515

16-
// eslint-disable-next-line @typescript-eslint/dot-notation
17-
const reactUseId = React['useId']
16+
// https://github.com/downshift-js/downshift/issues/1674#issuecomment-3924320872
17+
const SafeReact = {...React}
18+
const reactUseId = SafeReact.useId
1819

1920
// istanbul ignore next
2021
export const useElementIds: (

src/hooks/utils.dropdown/useElementIds.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ type UseElementIdsReturnValue = {
1919
inputId: string
2020
}
2121

22-
// eslint-disable-next-line @typescript-eslint/dot-notation
23-
const reactUseId = React['useId']
22+
// https://github.com/downshift-js/downshift/issues/1674#issuecomment-3924320872
23+
const SafeReact = {...React}
24+
const reactUseId = SafeReact.useId
2425

2526
export const useElementIds =
2627
typeof reactUseId === 'function' ? useElementIdsR18 : useElementIdsLegacy

0 commit comments

Comments
 (0)