You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read #6 and then #7. I saw that handling streams / observables doesn't make sense here, there are other hooks.
My situation is a little different. I'm using nostr, where I create a subscription over a websocket, and then I need to unsubscribe when my component is unmounted. Is there any support for running an async cleanup function in react-async-hook?
I'm sharing it here as maybe this better explains what I mean. Plus, if you don't think this is a good fit for this package, maybe somebody else will find this in the future following the same path I did. :-)
constSomethingContainer()=>{const[conditionUnmount,setUnmount]=useState(false);useEffect(()=>{return()=>{if(conditionUnmount){//clean up here}}})return<>{!unmount&&<YourFetcherComponent>}</>}
I read #6 and then #7. I saw that handling streams / observables doesn't make sense here, there are other hooks.
My situation is a little different. I'm using nostr, where I create a subscription over a websocket, and then I need to unsubscribe when my component is unmounted. Is there any support for running an async cleanup function in react-async-hook?
Here's an example of what I imagine:
Where I want
unsubscribeFunction
to be called once my component is unmounted. I don't think that's currently possible withuseAsync()
right?The text was updated successfully, but these errors were encountered: