Closed erixtekila closed 4 years ago
+1
I was plain wrong. The subscription handle is accessible in the query like so :
const C = ( { data, query } ) =>
{
useEffect(() => {
// returned function will be called on component unmount
return _ => query.subscriptionHandle.stop()
}, [])
return(
<>{ ...data }</>
)
}
Hi,
For now, we can get the query in the wrapped component, but we can't access is subscription handle, since it's done in the
withQuery
HOC. When the component is unmounted, react compains :Wouldn't it be handy to get the subscription handle too, to stop it in its
componentWillUnmount
method ?Any other prefered way ?
Thanks