AJAX handler for formwidget in repeater - best practice?

I have a formwidget, which is placed inside a repeater form field.

Now I need an AJAX handler to be called by a button click from this formwidget. When no repeater items are in place, the AJAX handler isn’t available, since the formwidget is not loaded.

I now placed a hidden element of this formwidget in my fields.yaml:

    _category:
        label: Neue Kategorie
        span: full
        type: newcategory
        hidden: true

Like this the AJAX handler is loaded any time.

I was wondering, if this is best practice or if there is a better solution to this issue.