Closed philholden closed 5 years ago
Good catch — I actually implemented this a while back but it must've gotten overridden 😅 Will fix asap!
For the time being, here's a working example that you can fork off of that will do this properly: https://stackblitz.com/edit/unmount-react?file=index.js
I am experiencing problems with
setInterval()
. This is becausecomponentWillUnmount()
is not getting called when the view is refreshed on key presses. I am making a network request every minute onsetInterval
. But a new request is being created every minute for every key stroke in the editor.I had the same problem in ReactPlaygroundStyled and got round it by unmounting the root before re-eval:
https://github.com/ncredinburgh/react-playground-buble/blob/master/packages/react-playground-bare/src/components/react-playground-bare.js