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 that 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 cause us. The best way to learn is by looking at examples, and we will do that by starting from a component that serves a single purpose and transforming it into a reusable one.
In this chapter, we will cover the following topics:
- The different methods we can follow to create React components, and when we should use one rather than...