react-native-multiple-modals
Version:
Native implementation with the ability to display multiple Modals
14 lines (13 loc) • 375 B
JavaScript
;
import { useEffect, useRef } from 'react';
const getRandomId = () => Math.random().toString(36);
export const useID = defaultID => {
const idRef = useRef(defaultID || getRandomId());
useEffect(() => {
return () => {
idRef.current = defaultID || getRandomId();
};
}, [defaultID]);
return idRef.current;
};
//# sourceMappingURL=useID.js.map