JSFiddle - React, Tailwind, and code Playground

HTML

<div id="links"> 
 <a data-curent-ext="com" href="http://www.google.com">google.com</a>
 <a data-curent-ext="com" href="http://www.yahoo.com">yahoo.com</a>
 <a data-curent-ext="com" href="http://www.bingo.com">bingo.com</a>
</div>

<div class="triggers"> 
 <a class="change" data-url-ext="rs" href="#">rs</a>
 <a class="change" data-url-ext="bla" href="#">bla</a>
</div>

JavaScript

$('.triggers').on('click', '.change', function () {
    var urlExt = $(this).data('url-ext');
    $('#links').find('a').each(function () {        
        var self = $(this);
        var cExt = self.attr("data-curent-ext");
        
        self.attr({'href': function() {            
            return this.href.replace(cExt, urlExt); 
        }, "data-curent-ext": urlExt}).text(function( index ) {
          return this.text.replace(cExt, urlExt);
        });
    });
});