{"version":3,"sources":["../src/usePrevious.ts"],"names":[],"mappings":";AAEA,SAAS,WAAW,cAAc;AAElC,SAAS,YAAe,OAAU;AAGjC,QAAM,MAAM,OAAU,KAAK;AAG3B,YAAU,MAAM;AACf,QAAI,UAAU;AAAA,EACf,GAAG,CAAC,KAAK,CAAC;AAGV,SAAO,IAAI;AACZ","sourcesContent":["'use client'\n\nimport { useEffect, useRef } from \"react\";\n\nfunction usePrevious<T>(value: T) {\n\t// The ref object is a generic container whose current property is mutable ...\n\t// ... and can hold any value, similar to an instance property on a class\n\tconst ref = useRef<T>(value);\n\n\t// Store current value in ref\n\tuseEffect(() => {\n\t\tref.current = value;\n\t}, [value]); // Only re-run if value changes\n\n\t// Return previous value (happens before update in useEffect above)\n\treturn ref.current;\n}\n\nexport { usePrevious };\n"]}