Introducing React patterns
With any programming language, framework, or library that you use, there are always common tactics that you should follow. They present an understandable, efficient way to write applications.
In Chapter 4, Hooking Apollo into React, we tackled some patterns, such as rendering arrays, the spread operator, and destructuring objects. Nevertheless, there are some further patterns that you should know about.
We will go over the most commonly used patterns that React offers, as follows:
- Controlled components
- Functional components
- Conditional rendering
- Rendering children
Many (but not all) of the examples here only represent illustrations of what each method looks like. Some of them will not be taken over to our real application code, so if you are not interested in learning the essential aspects of patterns or if you already know most of them, you can skip the examples.
Note
Beyond the short explanation that I will provide...