JSFiddle - React, Tailwind, and code Playground

HTML

<button id='test'>test</button>

JavaScript

$(document).ready(function(){
    function A(name){
        this.name=name
        
        var parent=this;
        $("#test").click(function(){
            console.log(parent.name);
        });
    }

    var t=new A('hello');
});