Evan You on Functional Components
In the previous lesson we learned about functional components. In this bonus lesson with Evan You, the creator of Vue, he explains the power of functional components and its use-cases.
Why Functional Components are Powerful
Evan explains how functional components are cheaper to render because they don’t have a Vue instance associated with them. Rather than creating a new Vue instance, they create an extra Virtual Node.
Major Use Cases
Evan specifies two major use-cases for functional components:
- Cheap leaf components that can be reused without the cost of instantiation stateful component (like above).
- Functional wrapper components.
As we saw in the previous lesson, a functional wrapper component helps us delegate to other components programmatically. Evan points out a great example of a functional wrapper component in the Vue-Router library, the router-view. This functional component looks at the current route and decides which component to render.