const functionCall = (event) => { console.log(event.target.getAttribute('a-key')); } <button a-key={1} onClick={functionCall}>Press Me</button>