Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/cf861bf8d64b46dec57b301169bc811c.json
2020-12-22 09:59:14 -05:00

1 line
815 B
JSON

{"ast":null,"code":"import { useState } from 'react';\n/**\n * A convenience hook around `useState` designed to be paired with\n * the component [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) api.\n * Callback refs are useful over `useRef()` when you need to respond to the ref being set\n * instead of lazily accessing it in an effect.\n *\n * ```ts\n * const [element, attachRef] = useCallbackRef<HTMLDivElement>()\n *\n * useEffect(() => {\n * if (!element) return\n *\n * const calendar = new FullCalendar.Calendar(element)\n *\n * return () => {\n * calendar.destroy()\n * }\n * }, [element])\n *\n * return <div ref={attachRef} />\n * ```\n */\n\nexport default function useCallbackRef() {\n return useState(null);\n}","map":null,"metadata":{},"sourceType":"module"}