Warns on access of props.key and props.ref#5744
Conversation
|
Link to SO could be change to a note in the docs |
props.key and props.refprops.key and props.ref
There was a problem hiding this comment.
This link explains about accessing key and not ref. Might be confusing to the reader.
There was a problem hiding this comment.
Right. The idea is to replace it with a link to relevant documentation being discussed at #5740
There was a problem hiding this comment.
This PR needs more work too. Its failing some tests
There was a problem hiding this comment.
We generally use fb.me urls that point to gists. I created one for you to use: https://fb.me/react-special-props
There was a problem hiding this comment.
63a3ea8 to
f861879
Compare
|
@prometheansacrifice updated the pull request. |
props.key and props.refprops.key and props.ref
|
@jimfb This PR is ready to be reviewed. Can you please have a look? |
There was a problem hiding this comment.
Let's explicitly add a return statement here. This is a getter, so we should return a value, and it makes the expected behavior a little more clear. Same with the getter for ref.
There was a problem hiding this comment.
Right. I'll wait for @spicyj's comment on the next line note and update this PR afterwards.
f861879 to
55607a8
Compare
|
@prometheansacrifice updated the pull request. |
|
@prometheansacrifice Can you add an explicit return statement as per above, and then I think this is ready to go. |
|
@jimfb Sure |
|
Don't forget to add it to both getters (key+ref), even though I just called out one of them. |
55607a8 to
c3980a6
Compare
|
@prometheansacrifice updated the pull request. |
|
This looks great, thanks @prometheansacrifice! |
…es-key-ref-props Warns on access of `props.key` and `props.ref`
Calls to props.ref will throw a warning in React v15. This commit hard-codes the value instead of reading props.ref. The iconButtonRef element has been removed from the state object, since it never changes after the component is initialized. React warnings discussed in this PR: facebook/react#5744
Attempt for fix 5742