Skip to content

Mixin

What are we learning here?

  • How to use the component factory Mixin

The class Mixin that we got to know in the previous chapter is not a real component, but a component factory function. With this you can create a simple component that just loads another simplify.

Furthermore, the newly created component ensures the forwarding and constant updating of the options to the other loaded component.

The function expects at least two parameters:

  • base: The base component that loads another.
  • load: The component to be loaded.

By default, the component to be loaded is loaded into the component element main (so basically this.element). For this purpose, the component element is converted into a stage.

This can be with the third and optional parameter adjusted. This is in the form of a function specified. This function receives the component instance as the first argument.

For example, to load the component into the stage main you specify this as follows:

Mixin(Base, Load, (c)=>c.stage));