I feel like this article is falling into a common performance trap. React is really fast by default and these deep equality checks and so on are usually slower than just rerendering the component. For performance, measure first and if your component is slow (which very very rarely happens) you can think about how to improve it. Check out this post for more details on performance cdb.reacttraining.com/react-inline.... So the perfect component does exist, and it's already the default component :D
Appreciate all your content just a bit worried that this post may mislead some newer folks :)
If you aren’t measuring, you can’t even know if your optimizations are better, and you certainly won’t know if they make things worse!
This totally makes sense! We use PureComponent everywhere where I am working ( It is like a rule ). You got me excited to measure the difference though. I will definitely try to do that in the near future. 😊
We're a place where coders share, stay up-to-date and grow their careers.
I feel like this article is falling into a common performance trap. React is really fast by default and these deep equality checks and so on are usually slower than just rerendering the component. For performance, measure first and if your component is slow (which very very rarely happens) you can think about how to improve it. Check out this post for more details on performance cdb.reacttraining.com/react-inline.... So the perfect component does exist, and it's already the default component :D
Appreciate all your content just a bit worried that this post may mislead some newer folks :)
Thanks for your comment. 🙏
This totally makes sense! We use
PureComponent
everywhere where I am working ( It is like a rule ). You got me excited to measure the difference though. I will definitely try to do that in the near future. 😊