souporserious / react-measure

📏 Compute measurements of a React component.
https://souporserious.github.io/react-measure/
MIT License
1.94k stars 109 forks source link

Remove usages of unsafe lifecycle methods #106

Open Hypnosphi opened 6 years ago

Hypnosphi commented 6 years ago

React team recently published a blogpost: https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html

TL;DR: cWM, cWRP, and cWU methods are considered unsafe for future async rendering and will be deprecated soon. The recommended way for open source maintainers to deal with it is to use react-lifecycles-compat package and migrate to new static getDerivedStateToProps method

souporserious commented 6 years ago

Thanks for the heads up! This won't be a problem in the new version :) please feel free to follow along here. I'll close this once it is released.

Hypnosphi commented 6 years ago

AFAIS this branch uses those lifecycles as well e.g. https://github.com/souporserious/react-measure/blob/03cf3a2046d971218c23ece7bde9614f64d42173/example/components/Collapse.js#L21

souporserious commented 6 years ago

Ah true! I'll make sure to update the examples 😇 thanks!