subtirelumihail / react-fullpage

A react implementation of fullpage.js
304 stars 105 forks source link

handleResize: Can only update a mounted or mounting component. #51

Open Krempelj opened 6 years ago

Krempelj commented 6 years ago

Hi. So navigating away from a component that uses this cool package and then resizing the displaying component causes this error. Is there a way to avoid this?

handleresize

Garoth commented 6 years ago

FWIW, I figured out what the issue here is. You have to .bind() your resize function before you assign it in window.addEventListener. Because this wasn't done, when the Section component tries to unmount, it doesn't correctly remove the resize listener (different function). The fix is trivial, but it looks like the author of this package is no longer resolving Pull Requests.

I will probably end up making a fork for my own projects