Bug: Allow suppressing warning message "Warning: `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."

This issue has been created since 2022-11-11.

React version:

Steps To Reproduce

  1. Pass key property to a component.
  2. Use JS logger (or simply console log) that deeply serializes to JSON.

Link to code example:
https://codesandbox.io/s/intelligent-moon-17p3rq?file=/src/App.js

The current behavior

Shows following warning:

Warning: ListItem: `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://reactjs.org/link/special-props)

The expected behavior

Some JS logging frameworks are trying to serialize the entire object so they don't know if they should access the key property, for example:

Logger.log(props);

In this case, we get an error message because it tries to reach the key property internally. Having an option to suppress this message allows us to optionally enable/disable it. Actually, accessing any object's property (unless private thus you cannot access anyways) should not generate a runtime warning/error.

More Details About Repo
Owner Name facebook
Repo Name react
Full Name facebook/react
Language JavaScript
Created Date 2013-05-24
Updated Date 2022-12-01
Star Count 198482
Watcher Count 6646
Fork Count 41196
Issue Count 1106

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
redirect setting for android 1 2022-02-22 2022-08-26
[BUG] quickminer resets overclock for disabled gpu 3 2022-03-23 2022-10-14
Composer install breaks gitpod 0 2022-05-04 2022-10-12
PIC register clobbered by ‘%ebx’ in ‘asm’ or illegal instruction. See #245 1 2022-11-10 2022-11-29
PIC register clobbered by ‘%ebx’ in ‘asm’ or illegal instruction 2 2022-11-10 2022-11-29
404 rewrite not working for SPAs like React 5 2022-01-19 2022-11-23
Stuck at open_by_handle_at when zoom flatpak is closed 3 2022-06-25 2022-09-30
Fix CARE_SITE documentation 0 2021-12-15 2022-11-11
Add countries Georgia and Kazakhstan 4 2021-10-04 2022-10-07
if using <> as datatype constructor, impossible to write corresponding match clause 2 2022-06-28 2022-11-19
[Task] Release to crates.io 5 2022-06-08 2022-07-19
[需求]本地监听TCP协议 5 2020-08-28 2021-12-29
Reintroduce build pipeline for 26.1 and 26.2 1 2021-03-28 2022-11-30
mic in docker should be installed with the same version that the user has on their local machine 2 2020-12-14 2022-11-18
If a model does NOT have versions but the entry exists, MIC fails 1 2020-11-30 2022-09-23
Configuration link in Useful links is broken 2 2022-02-22 2022-09-14
add Circ easing 0 2021-02-09 2022-01-21
no module markdown_it 26 2022-02-18 2022-11-18
Various 広辞苑 bugs 2 2021-03-12 2021-12-28
Animate Element Attributes 0 2021-06-07 2022-11-04
[Icon request] 0 2021-05-09 2022-01-10
Is it possible to use Injectable in a multi-module project? 3 2021-06-22 2022-11-02
OKD3.11 on-prem installation, deploy_cluster playbook takes long on the TASK [openshift_web_console : Verify that the console is running] 5 2020-08-04 2022-10-05
[Bug]: Search field is not working for all columns when app is generated using CRUD 1 2022-01-03 2022-10-18
@types/jest issue 4 2021-11-19 2022-01-23
Fatal Bug: {uuid}不生效 3 2022-04-25 2022-11-17
Please provide some timeline for .Net Core support 12 2017-05-05 2022-04-08
CI: build-and-test / build-package (rpm) fails due to CentOS 8 EOL 2 2022-02-02 2022-10-05
Can yarn provide an API to let me know the number of downloads of a package 1 2021-05-29 2022-10-26
The queue system has bugs 2 2021-06-26 2022-11-04
USDT & DAI 1 2021-11-02 2022-01-20
Add node-red-contrib-ibm-watson-iot please 5 2021-06-09 2022-11-05
Tablayout + Viewpager + Fragment的场景下,翻动Viewpager,立马用手按住界面,调用autoRefresh无法触发刷新 0 2021-04-01 2022-10-17
5135 is better 0 2021-05-16 2022-01-15
Multiple SLF4J Bindings problems when using gretty 2 2017-05-22 2022-11-17
x/tools/gopls: crash when renaming in a package using builtins with type parameters 7 2022-05-17 2022-12-01
Cookbook should not disable apparmor out of the box 1 2015-08-31 2022-10-27
"Spans from asynchronous executions will now be processed and flushed together" is a feature regression for us 5 2021-11-16 2022-10-12
Use posix_spawn in Subprocess 0 2021-10-11 2022-11-17
Confusing wording of arguments-differ? 1 2022-08-31 2022-09-16
Inaction regions are no longer grayed out after navigating away and back to a file 2 2021-09-30 2022-11-27
Lines are jagged in fullscreen 1 2021-02-24 2022-11-17
Client Allocation Request for: Jiliantech 5 2021-09-24 2021-09-21
SVG "animate" not working in chrome 1 2021-03-10 2022-11-19
Zooming occasionally fails if a scale factor has reached scale extend 0 2020-01-28 2022-10-27
A Problem that Only One Inference Can Be Made when I Loaded the Saved Model on Tensorflow-gpu 2.5.0 and latest. 5 2021-10-01 2022-10-30
Mechanism for keeping proofs up to date for cold state. 3 2021-08-13 2022-11-17
[Process] Windows REG utility not recognized as an internal or external command 0 2021-11-24 2022-09-13
Rename Spring Buildmaster to Spring Builds on CI 0 2021-08-25 2022-10-02
Exception from SQLite provider when application is shutting down 13 2022-01-06 2022-11-29