@carbon/ibm-products
Version:
Carbon for IBM Products
19 lines (17 loc) • 494 B
JavaScript
/**
* 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 };