defineKeyPropWarningGetter() — react Function Reference
Architecture documentation for the defineKeyPropWarningGetter() function in ReactJSXElement.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 1b0887cd_9134_1155_2c11_e7904b1a4478["defineKeyPropWarningGetter()"] 1bf5591f_27a1_c79f_853a_6242549e0e07["ReactJSXElement.js"] 1b0887cd_9134_1155_2c11_e7904b1a4478 -->|defined in| 1bf5591f_27a1_c79f_853a_6242549e0e07 ad281e06_8a7d_3988_f68c_33f816bae40c["jsxDEVImpl()"] ad281e06_8a7d_3988_f68c_33f816bae40c -->|calls| 1b0887cd_9134_1155_2c11_e7904b1a4478 12bdbda4_5438_2837_0178_e722d4b02c99["createElement()"] 12bdbda4_5438_2837_0178_e722d4b02c99 -->|calls| 1b0887cd_9134_1155_2c11_e7904b1a4478 style 1b0887cd_9134_1155_2c11_e7904b1a4478 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react/src/jsx/ReactJSXElement.js lines 121–141
function defineKeyPropWarningGetter(props, displayName) {
if (__DEV__) {
const warnAboutAccessingKey = function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
console.error(
'%s: `key` 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://react.dev/link/special-props)',
displayName,
);
}
};
warnAboutAccessingKey.isReactWarning = true;
Object.defineProperty(props, 'key', {
get: warnAboutAccessingKey,
configurable: true,
});
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does defineKeyPropWarningGetter() do?
defineKeyPropWarningGetter() is a function in the react codebase, defined in packages/react/src/jsx/ReactJSXElement.js.
Where is defineKeyPropWarningGetter() defined?
defineKeyPropWarningGetter() is defined in packages/react/src/jsx/ReactJSXElement.js at line 121.
What calls defineKeyPropWarningGetter()?
defineKeyPropWarningGetter() is called by 2 function(s): createElement, jsxDEVImpl.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free