I run into this issue where sockets.current[namespaceKey] can be undefined in ioProvider.tsx, I am referring to https://github.com/nitedani/socket.io-react-hook/blob/main/packages/socket.io-react-hook/src/IoProvider.tsx#L89.
Although it was semi reliably take place in my app when parent of component was re-rendering, I wasn't able to reproduce it with examples in your repo.
I ended up patching to (check if it's defined), I created this issue for visibility, in case someone else experiences the problem.