UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

23 lines (19 loc) 520 B
"use client"; import { useRef } from "react"; //#region src/hooks/use-lazy-mount/index.ts const useLazyMount = ({ children, lazy, lazyBehavior = "unmount", mounted }) => { const beforeMounted = useRef(false); if (!lazy) { beforeMounted.current = false; return children; } if (mounted) { beforeMounted.current = true; return children; } if (lazyBehavior === "keepMounted" && beforeMounted.current) return children; return null; }; //#endregion export { useLazyMount }; //# sourceMappingURL=index.js.map