DEV Community

Discussion on: Cache your React event listeners to improve performance.

Collapse
 
charlesstover profile image
Charles Stover • Edited

There are too many variables to make a blanket statement that memoization will always improve performance of a Component. For some Components, memoization may take longer than a full re-render!

I discovered this issue specifically due to a performance problem in one of my applications that was re-rendering on a short interval. The event listeners were being recreated each interval, and the application slowed to a crawl as a result. Memoization removed the lag entirely.

This article hopefully just educates on how it works, and each developer can determine if and how best to apply it to their own projects.