A very not-comprehensive introduction to the benefits of functional components.
I think the best way to learn about the benefits of functional components (especially, in this case, the useEffect
hook), is to implement a class component which eventually runs into a common issue faced by complex components. The world of functional components is huge, too huge for a single learning session, so I think a focused and specific practical example is the best approach to getting started with seeing the benefits of functional components.
As an aside, I recommend reading these articles:
- How Are Function Components Different from Classes?
- Writing Resilient Components
- A Complete Guide to useEffect
Let's begin. Go to the folder called level-one
.