In the last chapter, we saw how to take a coupled component and make it reusable step by step. In this section, we will see how to apply a similar pattern to our components to make them cleaner and more maintainable.
React components typically contain a mix of logic and presentation. By logic, we refer to anything that is unrelated to the UI, such as API calls, data manipulation, and event handlers. The presentation is, instead, the part inside the render method where we create the elements to be displayed on the UI.
In React, there is a simple and powerful pattern, known as container and presentational, which we can apply when creating components that help us to separate those two concerns.
Creating well-defined boundaries between logic and presentation not only makes components more reusable, but it provides many other benefits, which...