UNPKG

wix-style-react

Version:
11 lines 362 B
import { useRef } from 'react'; import uniqueId from 'lodash/uniqueId'; export const useId = (prefix) => { // FIXME: doesn't work in SSR, replace with `useId` from react 18 someday const idRef = useRef(); if (idRef.current === undefined) { idRef.current = uniqueId(prefix); } return idRef.current; }; //# sourceMappingURL=useId.js.map