Summary

Knowing all the best practices is always a good thing, but sometimes being aware of anti-patterns help us avoid taking the wrong path. Most importantly, learning the reasons why some techniques are considered bad practice helps us understand how React works and how we can use it effectively.

In this chapter, we covered four different ways of using components that can harm the performance and behavior of our web applications.

For each one of those, we used an example to reproduce the problem, and supplied the changes to apply in order to fix the issue.

We learned why using properties to initialize the state can result in inconsistencies between the state and the props, and we discovered why mutating the state is bad for performance. We also ...

Get React Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.