-
Notifications
You must be signed in to change notification settings - Fork 46.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warn on access of props.key
and props.ref
#5742
Comments
This sounds like a great idea to me! |
Yeah this seems reasonable. |
hi, I am interested in working on this; as I am looking forward to contribute. Kindly show me the way. Thanks in advance! |
Thanks @jimfb. Checking it out right away. |
@jimfb I have taken a look at the pull request, and associated code review comments. It seems the warn-once policy is required here, as implemented in https://github.com/facebook/react/blob/3b96650e39ddda5ba49245713ef16dbc52d25e9e/src/isomorphic/classic/element/ReactElementValidator.js I am not sure I fully understand how this module achieves this, so I am reading it now. As per the code review comments in #5744 , I am using the I feel like I could use some help on understanding this. Instead of using GitHub issue comments, is it possible to use some chat-platform such as IRC or slack room or Gitter? |
|
Sorry, I was away. #5744 is ready to be reviewed. |
The props
key
andref
are reserved by React, and used internally. Component authors may attempt to access these properties (thinking they could read the value, as per #5740). We could useObject.defineProperty
(in dev mode) to warn ifprops.key
orprops.ref
is accessed, and point the user to a note/discussion somewhere. That way, users who actually run into the issue will always get a timely message that sends them directly to the relevant explanation/discussion.This would be a good first bug, if we decide we actually want to do it.
The text was updated successfully, but these errors were encountered: