UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

35 lines (27 loc) 866 B
/** * Copyright IBM Corp. 2020, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; var React = require('react'); var uuidv4 = require('./uuidv4.js'); // 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. // // 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 */ const useId = _React.useId ? _React.useId : uuidv4.default; exports.useId = useId;