import * as _ from 'underscore';
import * as Backbone from 'backbone';

class BaseView extends Backbone.View {

  constructor(options = {}) {
    super(options);
    this._subviews = null;
  }

  assign(view, selector) {
    view.setElement(this.$(selector)).render();
  }

  registerSubView(view) {
    this._subviews = this._subviews || [];
    this._subviews.push(view);
  }

  remove() {
    _.invoke(this._subviews, 'remove');
    Backbone.View.prototype.remove.call(this);
  }

}

export default BaseView;

import * as _ from 'underscore';
import * as Backbone from 'backbone';

class BaseView extends Backbone.View {

  constructor(options = {}) {
    super(options);
    this._subviews = null;
  }

  registerSubView(view) {
    this._subviews = this._subviews || [];
    this._subviews.push(view);
  }

  remove() {
    _.invoke(this._subviews, 'remove');
    Backbone.View.prototype.remove.call(this);
  }

}

export default BaseView;

--- 
+++ 
@@ -6,10 +6,6 @@
   constructor(options = {}) {
     super(options);
     this._subviews = null;
-  }
-
-  assign(view, selector) {
-    view.setElement(this.$(selector)).render();
   }
 
   registerSubView(view) {
Update base view w/convenience function for rendering subviews

See:
http://ianstormtaylor.com/rendering-views-in-backbonejs-isnt-always-simp
le/
