You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
1.8 KiB
1 line
1.8 KiB
{"ast":null,"code":"import { useEffect, useRef } from 'react';\n/**\n * Store the last of some value. Tracked via a `Ref` only updating it\n * after the component renders.\n *\n * Helpful if you need to compare a prop value to it's previous value during render.\n *\n * ```ts\n * function Component(props) {\n * const lastProps = usePrevious(props)\n *\n * if (lastProps.foo !== props.foo)\n * resetValueFromProps(props.foo)\n * }\n * ```\n *\n * @param value the value to track\n */\n\nexport default function usePrevious(value) {\n var ref = useRef(null);\n useEffect(function () {\n ref.current = value;\n });\n return ref.current;\n}","map":{"version":3,"names":["useEffect","useRef","usePrevious","value","ref","current"],"sources":["C:/Cours/SAE/SAE-3.01/Scripted/Scripted/website/node_modules/@restart/hooks/esm/usePrevious.js"],"sourcesContent":["import { useEffect, useRef } from 'react';\n/**\n * Store the last of some value. Tracked via a `Ref` only updating it\n * after the component renders.\n *\n * Helpful if you need to compare a prop value to it's previous value during render.\n *\n * ```ts\n * function Component(props) {\n * const lastProps = usePrevious(props)\n *\n * if (lastProps.foo !== props.foo)\n * resetValueFromProps(props.foo)\n * }\n * ```\n *\n * @param value the value to track\n */\n\nexport default function usePrevious(value) {\n var ref = useRef(null);\n useEffect(function () {\n ref.current = value;\n });\n return ref.current;\n}"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,SAASC,WAAW,CAACC,KAAK,EAAE;EACzC,IAAIC,GAAG,GAAGH,MAAM,CAAC,IAAI,CAAC;EACtBD,SAAS,CAAC,YAAY;IACpBI,GAAG,CAACC,OAAO,GAAGF,KAAK;EACrB,CAAC,CAAC;EACF,OAAOC,GAAG,CAACC,OAAO;AACpB"},"metadata":{},"sourceType":"module"} |