This is part of my code in custom module in src/Plugin/Block/FavoriteBlock.php:
$build['ajax_link'] = [
'#type' => 'link',
'#title' => $this->npxFavoritesRepository->getTitle($node),
'#attached' => ['library' => ['npx_favorites/npx_favorites-library']],
'#attributes' => ['class' => $classes],
'#url' => Url::fromRoute('npx_favorites.ajax_link_callback', ['node' => $node->id()]),
];
And it results with output, that is fine, but it doesn't trigger the AJAX event:
<a href="/pl/favorite/1045/toggle" data-once="ajax" class="use-ajax n-favourite favorite-1045 active">Usuń z ulubionych</a>
So when I click on that it brings me to page that looks like that:
I have also another 'use-ajax' class from VUE template on the same page and it triggers the AJAX event. How can I make sure it is triggered, when I render this link from block?