How to reference a component itself on his event handle area

Hello,

How can I reference the current component in his event handler area?
somethig like, in a button component, when it's clicked hide it self.
image
image

The way I found is having a middle script, so in the button event handle it trigger the js then in to js on success event handle hide the button.


image

I'm asking for an easier way to achieve that, for every type of component, on their event handle area

Thanks

You cannot self reference but I would suggest that if there is a process/query that runs once the button is clicked you can add something like the following to the Hidden field for the button:

{{yourQueryWhenButtonIsClicked.isFetching}}

So while it runs the button will be hidden....