JSFiddle - React, Tailwind, and code Playground
HTML
<div id="element">click</div>
JavaScript
var data = {
test: 'test'
};
$('#element').on('click', function (event) {
console.log(event.custom)
});
$('#element').trigger({
type: 'click',
custom: data
});
data = {
test: 'foo' // doesn't matter, the data in the event handler will not change
};
$('#element').trigger({
type: 'click',
custom: data
});