Developer Tip
react
Seif Sgayer
React useEffect Cleanup
useEffect(() => {
const subscription = api.subscribe();
return () => {
// Always cleanup subscriptions!
subscription.unsubscribe();
};
}, []);
useEffect(() => {
const subscription = api.subscribe();
return () => {
// Always cleanup subscriptions!
subscription.unsubscribe();
};
}, []);