JSFiddle - React, Tailwind, and code Playground

by bstst

JavaScript

// separate component
var C = (function() {
  function C() {
    console.log('C');
    this.action();
  }
  C.prototype.action = function() {
    console.log('some action');
  };
  return C;
})();

// separate component
// C = require('C');
var B = (function() {
  function B() {
    console.log('B');
  }
  B.prototype.bar = function() {
    var c;
    c = new C();
  };
  return B;
})();

// separate component
// B = require('B');
var A = (function() {
  function A() {
    var b;
    console.log('A');
    b = new B();
    b.bar();
  }
  return A;
})();

// app 1
// A = require('A');
new A();
/*
A
B
C
some action 
*/

// app 2
// A = require('A');
// here I want C.action to behave differently.
new A();