podefr/react-debounce-render

Drop componentWillReceiveProps in favor of the more future-proof getDerivedStateFromProps

Closed this issue · 2 comments

yched commented

As outlined in https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#open-source-project-maintainers, it is recommended to use the new (react-async compatible) getDerivedStateFromProps rather than componentWillReceiveProps.

Libraries can use the react-lifecycles-compat polyfill to stay compatible with react < 16.3

yched commented

Actually, it seems like the content of react-debounce-render's componentWillReceiveProps could be done in componentDidUpdate ? (and then no need for react-lifecycles-compat)

Hi Yves, thanks for the suggestion. Unfortunately neither solution is a 1:1 replacement for componentWillReceiveProps, I need to spend more time figuring out how to implement the debounce feature with the new lifecycle methods. Feel free to give it a shot and prepare a Pull Request if you find a solution :)