DEV Community

Discussion on: Using WebSockets with React.js, the right way (no library needed)

Collapse
zyabxwcd profile image
zyabxwcd

Your structuring and code looks good but still somehow I find it messy and hard to read without spending time to break it down. Passing down context and utilising useReducer was neat.

Collapse
itays123 profile image
Itay Schechner Author

Thank you for your feedback. Do you have any useful tips? Perhaps I should practice more code splitting?

Collapse
zyabxwcd profile image
zyabxwcd

Maybe I am not sure. I would highly encourage you to go through Airbnb's style guide. They have documented some really good practices. I read some of it a long time ago. Majorly I guess there should be good indentation that separates code logically or functionally. I personally like to club declarations, conditions and returns. Separation of concerns is also an under practised guideline although its very famous. Moreover I came across this article coincidentally the other day, dev.to/dhaiwat10/become-a-better-w...
I think this will help you :)