react-keydown icon indicating copy to clipboard operation
react-keydown copied to clipboard

componentWillReceiveProps will be deprecated

Open iqqmuT opened this issue 7 years ago • 4 comments

According to React, using componentWillReceiveProps() is a bad idea and it will be deprecated soon, version 17 seems to be the last supporting the method with that name.

When using keydown for classes, what should be the proper way to handle the key events?

iqqmuT avatar Sep 24 '18 09:09 iqqmuT

One way to do this will be to do the detection in getDerivedStateFromProps and return state related to keydown state that you can then reference in other lifecycle methods.

https://hackernoon.com/replacing-componentwillreceiveprops-with-getderivedstatefromprops-c3956f7ce607

glortho avatar Sep 24 '18 12:09 glortho

Apologies for commenting on a long-closed issue, but does the fact that it's closed mean that you don't intend to update method_decorator_scoped.js to avoid using componentWillReceiveProps?

jamesremuscat avatar Aug 12 '19 16:08 jamesremuscat

Hi @jamesremuscat -- I'm a bit swamped at the moment but very happy to review a PR if anyone wants to tackle this. Reopening.

glortho avatar Aug 19 '19 14:08 glortho

interested in this one, how to handle new function components? , is there a way to use keydown with compose?

faq885 avatar Feb 13 '20 12:02 faq885