react-socket-io
                                
                                
                                
                                    react-socket-io copied to clipboard
                            
                            
                            
                        how to emit event
I don't konw how to emit event,I konw use Event to revceive enent,but how to emit one thing?
Had the same issue. Was able to access the emit method by attaching the context to the component:
SomeComponent.contextType = SocketContext;
And then in the component access emit via:
this.context.emit...
SocketContext can be imported from react-socket-io.
Emit is callable but I did not manage to get it working. Created my own React Context object instead and used the socket.io directly.