What You Learned

Storing logic in separate functions, in addition to giving you more freedom to reorganize your components, makes your code more testable.

To test components, isolate slices of the application with Enzyme and check that props propagate correctly from parent to children.

Snapshots verify that you did not introduce undesired changes into how your React elements render.

Writing good tests forces you to think about the boundaries between components: that is precisely what you need to avoid spreading state everywhere.

Now that you’ve got testing under your belt, you’re ready to tackle more complex architectures. In the next chapter, you will learn how to use the Redux architecture.

Get React for Real 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.