Pure functions
A function whose returns depend only on its arguments and have no side effects during execution is called pure.
Introduction to advanced components
Vue is implemented as mixins, and the concept of higher-order components is missing from the official documentation because it is difficult to implement higher-order components in Vue, unlike react
Higher-order component: A higher-order function, that is, a function that returns a component function
Higher-order components have the following characteristics
- Higher-order components should be pure functions with no side effects and should not modify the original component, that is, the original component cannot be changed
- Doesn’t care what data you’re passing, and the newly generated component doesn’t care where the data came from
- The props received should be passed to the wrapped component, that is, the prop from the original component should be passed directly to the wrapped component
- Advanced components can be added, modified, and deleted
Refer to the article: blog.csdn.net/z609373067/…