react-native-multiple-modals
Version:
Native implementation with the ability to display multiple Modals
19 lines (18 loc) • 492 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useID = void 0;
var _react = require("react");
const getRandomId = () => Math.random().toString(36);
const useID = defaultID => {
const idRef = (0, _react.useRef)(defaultID || getRandomId());
(0, _react.useEffect)(() => {
return () => {
idRef.current = defaultID || getRandomId();
};
}, [defaultID]);
return idRef.current;
};
exports.useID = useID;
//# sourceMappingURL=useID.js.map