podefr / react-debounce-render

A React higher order component to debounce the rendering of your React components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning with react 16.5.0 : "It is not recommended to assign props directly to state..."

yched opened this issue · comments

From the react 16.5.0 release notes :
"Warn when this.state is initialized to props react issue 11658"

react-debounce-render does just that, and thus triggers the newly added warning every time :-)

@yched thanks for raising the issue and suggesting a PR. Your solution is a lot more elegant than my original solution and it also fixes a number of issues including using legacy react lifecycle methods or directly persisting props as states which is normally an anti-pattern.
I published version 5.0.0 with the changes from your PR. Please let me know if you're happy with it and feel free to close this issue.

thanks again!

Yay, thanks for merging this @podefr :-)

I'm currently on a holiday, so I can't easily check, but the commits do look fine.

Closing this, then.