anycable-client
anycable-client copied to clipboard
Use with React Strict Mode
Hi there...
Is there any best practice for use with Strict Mode? I am working on a chat application and I am receiving messages twice. If I try to do this:
useEffect(() => {
...
return () => {
cable.unsubscribe(channel);
};
});
I get errors that the channel is unsubscribed.
Any ideas? Thanks!
You should use channel.disconnect() instead of cable.unsubscribe(channel) to avoid double-unsubscribe errors.
Re: receiving twice. Could you please share the full snippet related to AnyCable?