Stanko / react-animate-height

Lightweight React component for animating height using CSS transitions. Slide up/down the element, and animate it to any specific height.
https://muffinman.io/react-animate-height
MIT License
758 stars 53 forks source link

Add mount checks in requestAnimationFrame() #83

Closed atombender closed 5 years ago

atombender commented 5 years ago

This should fix #82.

Stanko commented 5 years ago

Thank you for the PR, but I fixed it in a little bit different manner, you can see it here: https://github.com/Stanko/react-animate-height/commit/1d2324a071966677155e6b627c698b6583454d5e

AFAIK checking if component is mounted is considered an antipattern: https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html

Cheers!

atombender commented 5 years ago

No worries, thanks for the fix. I wasn't using isMounted(), though, but in fact one of the solutions recommended in that article. 🙂