JSFiddle - React, Tailwind, and code Playground

HTML

<a data-bookmark-item="2" data-userid="501" class="getbook">John Grisham</a>
<a data-bookmark-item="3" data-userid="551" class="getbook">J.K Rowling</a>
<a data-bookmark-item="4" data-userid="201" class="getbook">JRR Tolkien</a>

JavaScript

$(document).on('click', '.getbook', function() {
        var bookMark = $(this).data('bookmark-item'),
            userId = $(this).data('userid');

        alert( bookMark + ' for user: '+ userId );
        //somefunction( bookMark, userId ); //Pass them through to where needed.
    });