@dark-engine/core
Version:
The lightweight and powerful UI rendering engine without dependencies and written in TypeScript (Browser, Node.js, Android, iOS, Windows, Linux, macOS)
14 lines (13 loc) • 453 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
exports.useId = void 0;
const use_memo_1 = require('../use-memo');
const scope_1 = require('../scope');
function useId() {
const id = (0, use_memo_1.useMemo)(() => getNextId((0, scope_1.getRootId)()), []);
return id;
}
exports.useId = useId;
let nextId = 1000000;
const getNextId = rootId => `dark:${rootId}:${(++nextId).toString(36)}`;
//# sourceMappingURL=use-id.js.map