React and React Native
上QQ阅读APP看书,第一时间看更新

Chapter 5. Crafting Reusable Components

The focus of this chapter is to show you how to implement React components that serve more than just one purpose. After reading this chapter, you'll feel confident about how to compose application features.

We'll start the chapter off with a brief look at HTML elements and how they work in terms of helping to implement features versus having a high level of utility. Then, we'll look at the implementation of a monolithic component and discuss the issues that it will cause down the road. The next section is devoted to re-implementing the monolithic component in such a way that the feature is composed of smaller components.

Finally, the chapter ends with a discussion of rendering trees of React components, and gives you some tips on how to avoid introducing too much complexity as a result of decomposing components. We'll close this final section by reiterating the concept of high-level feature components versus utility components.