Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/6e1969ca4bb332cbb3a9f53a365...

1 line
995 B
JSON

{"ast":null,"code":"import { useReducer } from 'react';\n/**\n * Returns a function that triggers a component update. the hook equivalent to\n * `this.forceUpdate()` in a class component. In most cases using a state value directly\n * is preferable but may be required in some advanced usages of refs for interop or\n * when direct DOM manipulation is required.\n *\n * ```ts\n * const forceUpdate = useForceUpdate();\n *\n * const updateOnClick = useCallback(() => {\n * forceUpdate()\n * }, [forceUpdate])\n *\n * return <button type=\"button\" onClick={updateOnClick}>Hi there</button>\n * ```\n */\n\nexport default function useForceUpdate() {\n // The toggling state value is designed to defeat React optimizations for skipping\n // updates when they are stricting equal to the last state value\n var _useReducer = useReducer(function (state) {\n return !state;\n }, false),\n dispatch = _useReducer[1];\n\n return dispatch;\n}","map":null,"metadata":{},"sourceType":"module"}