paint-brush
What I learned from building a chat project with sockets.io and Reactby@alexcloudstar
379 reads
379 reads

What I learned from building a chat project with sockets.io and React

by Alex Cloudstar2mAugust 13th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A few days ago I’ve built a React application with socket.io. I noticed that on a lot of messages my app starts to be slow and do some lag spikes. I used callbacks that didn’t help a lot because I had almost all of the state at the root of the app and I basically killed the memoization. After some I did some search on Google, and I found an article with a developer who had the same issue. The awarded response was to use socket.off into the cleanup function of useEffect. After I tried this one, all the apps worked like a charm.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - What I learned from building a chat project with sockets.io and React
Alex Cloudstar HackerNoon profile picture
Alex Cloudstar

Alex Cloudstar

@alexcloudstar

Hi there! 👋🏻 I'm a Senior Full-Stack Developer oriented on Javascript.

Learn More
LEARN MORE ABOUT @ALEXCLOUDSTAR'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Alex Cloudstar HackerNoon profile picture
Alex Cloudstar@alexcloudstar
Hi there! 👋🏻 I'm a Senior Full-Stack Developer oriented on Javascript.

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite