{"version":3,"file":"usePrevious.mjs","names":[],"sources":["../src/usePrevious.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useEffect, useRef } from \"react\";\n\nexport const usePrevious = <T>(value: T): T | undefined => {\n  const ref = useRef<T | undefined>(undefined);\n  useEffect(() => {\n    ref.current = value;\n  });\n  return ref.current;\n};\n"],"mappings":";;;;;;;;;AAUA,MAAa,eAAkB,UAA4B;CACzD,MAAM,MAAM,OAAsB,KAAA,EAAU;AAC5C,iBAAgB;AACd,MAAI,UAAU;GACd;AACF,QAAO,IAAI"}