-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(EmptyState): added useId handling for older react version (#6620)
* fix(EmptyState): added useId handling for older react version * fix(EmptyState): fixed imports for useId --------- Co-authored-by: Sean Anderson <[email protected]>
- Loading branch information
1 parent
a8985c2
commit 45af420
Showing
7 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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,21 @@ | ||
// | ||
// Copyright IBM Corp. 2021, 2024 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
import React from 'react'; | ||
import uuidv4 from './uuidv4'; | ||
|
||
// This tricks bundlers so they can't statically analyze this and produce | ||
// compilation warnings/errors. | ||
// https://github.com/webpack/webpack/issues/14814 | ||
// https://github.com/mui/material-ui/issues/41190 | ||
const _React = { ...React }; | ||
|
||
/** | ||
* Uses React 18's built-in `useId()` when available, or falls back to | ||
* using uuidv4 otherwise | ||
*/ | ||
export const useId = _React.useId ? _React.useId : uuidv4; |