UNPKG

@carbon/ibm-products

Version:
19 lines (17 loc) 494 B
/** * Copyright IBM Corp. 2020, 2026 * * 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 uuidv4 from "./uuidv4.js"; import React from "react"; //#region src/global/js/utils/useId.jsx 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; //#endregion export { useId };