JSFiddle - React, Tailwind, and code Playground

by Rishabh Sharma

JavaScript

class A {
	constructor() {
  	
  }
  
	foo(fn) {
  	fn();
  }
}

class B {
	constructor() {
  	this.a = 'a';
  }
  
  handler() {
  	console.log(this.a);
  }
  
  render() {
  	var aInstance = new A();
    aInstance.foo(this.handler);
  }
}

var bInstance = new B();
bInstance.render();