Chapter 3. Create Truly Reusable Components
To create truly reusable components we have to understand the different possibilities that React gives us for defining components and when it is better to choose one or another. A new type of component has been introduced in React which lets us declare a component as a stateless function. It is crucial to understand this component and learn when and why it should be used.
You may have already utilized the internal state of components, but you may still be unclear about when it should be used and the problems it can give us. The best way to learn is by seeing examples, and we will do that by starting from a component which serves a single purpose and transforming it into a reusable one.
Let's first take a step back and revisit the basic concepts, so that we can move forward and create a living style guide of components by the end of this chapter.
In this chapter we will see:
- The different ways we can follow to create React components...