MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / defineRefPropWarningGetter

Function defineRefPropWarningGetter

code/third-party/public/app.js:17936–17948  ·  view source on GitHub ↗
(props, displayName)

Source from the content-addressed store, hash-verified

17934}
17935
17936function defineRefPropWarningGetter(props, displayName) {
17937 var warnAboutAccessingRef = function () {
17938 if (!specialPropRefWarningShown) {
17939 specialPropRefWarningShown = true;
17940 warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
17941 }
17942 };
17943 warnAboutAccessingRef.isReactWarning = true;
17944 Object.defineProperty(props, 'ref', {
17945 get: warnAboutAccessingRef,
17946 configurable: true
17947 });
17948}
17949
17950/**
17951 * Factory method to create a new React element. This no longer adheres to

Callers 1

createElementFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected