Files
portfolio/public/node_modules/.cache/babel-loader/abbf846f9283aa9edd91377072d3c669874b52c01875c5eeb55650e4fb5e0170.json
T
2024-12-18 12:31:06 -07:00

1 line
1.9 KiB
JSON

{"ast":null,"code":"import { useEffect, useRef } from 'react';\n\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 */\nexport default function usePrevious(value) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}","map":{"version":3,"names":["useEffect","useRef","usePrevious","value","ref","current"],"sources":["/home/violet/documents/development/portfolio/public/node_modules/react-bootstrap/node_modules/@restart/ui/node_modules/@restart/hooks/esm/usePrevious.js"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\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 */\nexport default function usePrevious(value) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,WAAWA,CAACC,KAAK,EAAE;EACzC,MAAMC,GAAG,GAAGH,MAAM,CAAC,IAAI,CAAC;EACxBD,SAAS,CAAC,MAAM;IACdI,GAAG,CAACC,OAAO,GAAGF,KAAK;EACrB,CAAC,CAAC;EACF,OAAOC,GAAG,CAACC,OAAO;AACpB","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}