wix-style-react
Version:
wix-style-react
11 lines • 362 B
JavaScript
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