@atlaskit/motion
Version:
A set of utilities to apply motion in your application.
21 lines (19 loc) • 690 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useUniqueId = useUniqueId;
var _react = require("react");
/* eslint-disable @repo/internal/react/disallow-unstable-values */
/**
* Will return a unique id that does not change between renders.
* Try not use this to render DOM markup (attributes or otherwise)
* as you will probably not get the same result on the Server vs. Client.
*/
function useUniqueId() {
var identifier = (0, _react.useRef)('');
if (!identifier.current) {
identifier.current = '_' + (Number(String(Math.random()).slice(2)) + Date.now() + Math.round(performance.now())).toString(36);
}
return identifier.current;
}