   currentData: (path, equalsFunc) ->
     @constructor.currentData path, equalsFunc
 
-  # Useful in templates to get a reference to the component.
+  # Useful in templates or mixins to get a reference to the component.
   component: ->
-    @
+    component = @
+
+    loop
+      # If we are on a mixin without mixinParent, we cannot really get to the component, return null.
+      return null unless component.mixinParent
+
+      # Return current component unless there is a mixin parent.
+      return component unless mixinParent = component.mixinParent()
+      component = mixinParent
 
   # Caller-level component. In most cases the same as @, but in event handlers
   # it returns the component at the place where event originated (target component).

    # when structure change in rendered DOM. You can change the component you are including (or pass
    # different arguments) reactively though.
    Tracker.nonreactive =>
      component = @

      # If mixins have not yet been created.
      component.createMixins()


  # Maybe a preexisting template helper on the component's base template.
  if component
    # We know that component is really a component.
    if (helper = component._componentInternals?.templateBase?.__helpers.get name)?
      return wrapHelper bindDataContext(helper), templateInstance

