Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/a582af94b92c8b2d5e52115a39426a96.json
2020-12-31 20:18:50 +00:00

1 line
701 B
JSON

{"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":null,"metadata":{},"sourceType":"module"}