By state var you mean having a setState({isUnmounted:true}) in the cleanup function of the first useEffect?
Don't think that will work, it might complain with the same: Cannot setState on unmounted warning. It seems refs are kept around even after Component unmounts, that's why they work in this case.
The React docs are a bit confusing, because they state refs live the same lifetime as components but obviously they stick around at least for as long as your async code still runs.
By state var you mean having a setState({isUnmounted:true}) in the cleanup function of the first useEffect?
Don't think that will work, it might complain with the same: Cannot setState on unmounted warning. It seems refs are kept around even after Component unmounts, that's why they work in this case.
The React docs are a bit confusing, because they state refs live the same lifetime as components but obviously they stick around at least for as long as your async code still runs.
Great, that's good to know, thanks!