Skip to content

Easier-to-use HOC method #5934

Closed
Closed
@yaodingyd

Description

@yaodingyd

What problem does this feature solve?

Currently I can't find anything official Vue document to create HOC. The closest thing I can find on the web is this post https://medium.com/tldr-tech/higher-order-components-in-vue-js-38b500c6d49f and spreading all the properties seem verbose.

I think the popular way to achieve composition in Vue component is to use mixins, and there are some common problems for minxins:

  1. Mixins introduce implicit dependencies
  2. Mixins cause name clashes
  3. Mixins cause snowballing complexity
    I know for 2 Vue handles conflicting pretty well and for 3, I personally think it would be developer's own fault to using an "escape hatch" to finish complex composition. but still 1 could be a problem. So my next question is, does Vue promotes the use of mixin?

What does the proposed API look like?

Maybe something like Vue.composite(wrappedComponents, addedProperties)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions