Question about React.js component unmounting
dlaynes opened this issue · 1 comments
dlaynes commented
Does Talk.js provide a destroy(), unload(), or similar function?
In SPAs, sometimes the same page is loaded more than once, and I want to prevent possible memory leaks:
https://reactjs.org/docs/integrating-with-other-libraries.html
Example of what I think would happen:
facebook/react#7128
Thanks
eteeselink commented
Hi @dlaynes sorry for the late response!
This is a very good point, and it's missing in the example. Fortunately, we do have a destroy function: https://talkjs.com/docs/api/classes/inbox.html#destroy
That ought to go in the componentWillUnmount
, we'll update the example. Thanks for pointing this out!