DEV Community

Discussion on: React Component Lifecycle Explained

Collapse
 
theoutlander profile image
Nick Karnik

Thank you, Marco, for pointing that out. You are right about the methods in the constructor creating new functions for each instance. I was trying to focus on lifecycle methods and wanted to keep the recording short, so I took a few shortcuts. I should have mentioned that in my video.

It is incumbent upon me to do a follow-up video to highlight the pros and cons of the various ways we can define and use functions in a class! :o

In the grand scheme of things, the performance overhead for this approach is pretty low if you're instantiating a handful of instances or instantiating them infrequently. And, it won't be noticeable to us. It works fine in this example. However, when focusing on performance, this is not the right approach.