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

Function defineRefPropWarningGetter

code/redux/public/app.js:20047–20059  ·  view source on GitHub ↗
(props, displayName)

Source from the content-addressed store, hash-verified

20045}
20046
20047function defineRefPropWarningGetter(props, displayName) {
20048 var warnAboutAccessingRef = function () {
20049 if (!specialPropRefWarningShown) {
20050 specialPropRefWarningShown = true;
20051 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);
20052 }
20053 };
20054 warnAboutAccessingRef.isReactWarning = true;
20055 Object.defineProperty(props, 'ref', {
20056 get: warnAboutAccessingRef,
20057 configurable: true
20058 });
20059}
20060
20061/**
20062 * 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