1 line
982 B
JSON
1 line
982 B
JSON
{"ast":null,"code":"import invariant from 'invariant';\nimport { useCallback } from 'react';\nimport useMergedRefs from '@restart/hooks/useMergedRefs';\nexport default function useWrappedRefWithWarning(ref, componentName) {\n if (!(process.env.NODE_ENV !== \"production\")) return ref; // eslint-disable-next-line react-hooks/rules-of-hooks\n\n var warningRef = useCallback(function (refValue) {\n !(refValue == null || !refValue.isReactComponent) ? process.env.NODE_ENV !== \"production\" ? invariant(false, componentName + \" injected a ref to a provided `as` component that resolved to a component instance instead of a DOM element. \" + 'Use `React.forwardRef` to provide the injected ref to the class component as a prop in order to pass it directly to a DOM element') : invariant(false) : void 0;\n }, [componentName]); // eslint-disable-next-line react-hooks/rules-of-hooks\n\n return useMergedRefs(warningRef, ref);\n}","map":null,"metadata":{},"sourceType":"module"} |