Professional Documents
Culture Documents
Evan You On Functional Components - Advanced Components - Vue Mastery
Evan You On Functional Components - Advanced Components - Vue Mastery
Let’s say we have 100 items on a list on our webpage, each consisting of 3 base button components
(Ex. could be show/edit/delete). This could add up to 300 Vue instances. If we refactor the base button
components to be functional components, we save 300 instances from being instantiated, which in
turn means less javascript to execute and less memory to allocate (everything runs faster).
1. Cheap leaf components that can be reused without the cost of instantiation stateful component
(like above).
2. 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.
https://www.vuemastery.com/courses/advanced-components/evan-you-on-functional-components 1/1