JSFiddle - React, Tailwind, and code Playground
by rlemon
HTML
<div id="foo">click me</div>
JavaScript
function handler(e) {
console.log('handled');
}
var foo = document.getElementById('foo');
foo.onclick = handler(); // the return of the function is undefined, and due to how the handlers work this results in 'null'
console.log( foo.onclick ); // null
foo.onclick = handler; // passing a ref to the function to the onclick.
console.log( foo.onclick ); // function handler(e) { console.log('handled'); return false; }