MCPcopy Index your code
hub / github.com/reactjs/react-rails / forwardRef

Function forwardRef

lib/assets/react-source/development/react.js:1808–1831  ·  view source on GitHub ↗
(render)

Source from the content-addressed store, hash-verified

1806 }
1807
1808 function forwardRef(render) {
1809 {
1810 if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1811 error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1812 } else if (typeof render !== 'function') {
1813 error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1814 } else {
1815 if (render.length !== 0 && render.length !== 2) {
1816 error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
1817 }
1818 }
1819
1820 if (render != null) {
1821 if (render.defaultProps != null || render.propTypes != null) {
1822 error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1823 }
1824 }
1825 }
1826
1827 return {
1828 $$typeof: REACT_FORWARD_REF_TYPE,
1829 render: render
1830 };
1831 }
1832
1833 function isValidElementType(type) {
1834 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.

Callers

nothing calls this directly

Calls 1

errorFunction · 0.70

Tested by

no test coverage detected