This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
I'm looking for help on best practices for integrating a websocket library throughout my react project. It's not a generic ws library, it's designed specifically to talk to ROS (roslibjs). It requires a setup constructor to establish a connection, then multiple callbacks for when the connection has been established or if there were any errors.
I initially created a hoc component that does this all in componentdidmount and sets willupdate to false. I was originally going to make class functions do some of the websocket message sending/receiving however this would have required some 10-12 levels of prop drilling. I'd like to make it so a button way down the chain can send a websocket message.
I just want a good idea on how to structure this, best practices, whether or not I'm thinking this out wrong etc. I'm happy to use something like Redux but have avoided it until I needed.
Post Details
- Posted
- 6 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/reactjs/com...