JSFiddle - React, Tailwind, and code Playground

by Alfie

HTML

<button id="trigger" data-event="Test">click</button>

JavaScript

$(function(){
    var events = {
        Test : function(){
            console.log ('init');
        }
    }
    $('#trigger').click(function(){
        var e = $(this).data('event');
        events[e]();
    });
});