I'm trying to store and retrieve a socket.io session but react is throwing an error saying that it can't save a circular object.
I've tried to stringify the object but no luck. Any work around without going into Redux?
Store:
localStorage.setItem('socket', JSON.stringify(socket));
Retrieve:
const socket = localStorage.getItem("socket");
Attempting to stringify the object returns:
Uncaught TypeError: Converting circular structure to JSON
at Object.stringify (<anonymous>)
at <anonymous>:1:7