DEV Community

Discussion on: Using WebSockets in React

Collapse
 
lai32290 profile image
Lai Xuancheng

My experience about WebSocket + React is implementing the connection in Redux middleware, including all the received event handler to dispatch Redux action automatically and to it has to do.

And dispatching a action like:
{
type: "SOCKET_XXXXXX"
}

to send event from client to server.

I'll try your solution for next time, it seems really work.

Thanks for share.