Skip to content
loading...

re: Learn Public Class Field Syntax by Refactoring a React Component VIEW POST

FULL DISCUSSION
 

When we use class fields to add methods [...], the class fields are added to the instance itself instead of the prototype.

Interesting, I did not know this before reading your post! For maintainability, I tend to prefer clean code over worrying about micro optimisation details, but I can definitely see this adding performance overhead if lots of these components are needed for an app. I'll certainly bear this in mind when writing future React components!

 

Agree, quick write & clean code first, optimisation later

code of conduct - report abuse