JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test">Click Me</div>

CSS

#test{
	border: 1px solid;
	padding: 10px;
	display: inline-block;
  cursor: pointer;
}

Babel + JSX

const makeLog = function(e) {
	console.log(e.data);
};

const makeObj = function() {
	this.logMe = (target, msg) => {
  	// just in case the method is ran more than once we remove any click handler previously attached
  	$("#"+target).off("click");
    // now attach the click handler to the element.
  	$("#"+target).click(msg, makeLog);
	} 
};

const myObj = new makeObj();

myObj.logMe("test", "hello");
myObj.logMe("test", "world");
myObj.logMe("test", "how are you?");