NetanelBasal
9/29/2017 - 8:18 AM

class-decorator-modify.ts

export function logRender(constructor: Function) {
  const original = constructor.prototype.render;

  constructor.prototype.render = function() {
    console.log(`Rendering ${constructor.name}...`);
    return original.apply(this, arguments);
  };
}


@logRender
class Todos extends Component {
  render() {
    return (...);
  }
}