@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
1 lines • 644 B
Source Map (JSON)
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../src/hooks/use-previous/index.ts"],"sourcesContent":["\"use client\"\n\nimport { useEffect, useRef } from \"react\"\n\n/**\n * `usePrevious` is a custom hook for obtaining the previous value.\n *\n * @see https://yamada-ui.com/docs/hooks/use-previous\n */\nexport const usePrevious = <Y>(value: Y) => {\n const ref = useRef<undefined | Y>(undefined)\n\n useEffect(() => {\n ref.current = value\n }, [value])\n\n return ref.current\n}\n"],"mappings":";;;;;;;;;;;;;AASA,MAAa,eAAkB,UAAa;CAC1C,MAAM,wBAA4B,OAAU;AAE5C,4BAAgB;AACd,MAAI,UAAU;IACb,CAAC,MAAM,CAAC;AAEX,QAAO,IAAI"}