For a quick and dirty reduction in wall-time and wasted renders, you can use lodash’s isEqual in…
Timothy Laurent
1

Using a deep equality comparison only solves the ‘Object Copying’ problem. You still have to watch out for the other gotchas mentioned in the post :)

Also, be careful with _.isEqual since the performance characteristics are harder to reason about, especially if you are using complex objects in your props / state. As with any performance optimizations, profile your code first to see if the optimization is worth it.

Show your support

Clapping shows how much you appreciated Dounan Shi’s story.