How to use the react-uid.useUIDSeed function in react-uid

To help you get started, we’ve selected a few react-uid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nordnet / ui / src / Molecules / Drawer / Drawer.tsx View on Github external
} = ({ className, children, onClose, open: isOpenExternal, title }) => {
  const isControlled = isBoolean(isOpenExternal);
  const escapePress = useKeyPress('Escape');
  const [isOpenInternal, setIsOpenInternal] = useState(true);
  const isOpen = isControlled ? isOpenExternal : isOpenInternal;
  const isDesktop = useMedia(t => t.media.greaterThan(t.breakpoints.sm)) || false;
  const seed = useUIDSeed();
  const uid = seed(displayName);

  const handleCloseClick = () => {
    setIsOpenInternal(false);

    if (onClose) {
      onClose();
    }
  };

  useEffect(() => {
    if (isOpen && escapePress) {
      handleCloseClick();
    }
  }, [escapePress, isOpen]);

react-uid

Render-less container for ID generation

MIT
Latest version published 1 year ago

Package Health Score

56 / 100
Full package analysis