JSFiddle - React, Tailwind, and code Playground
JavaScript
//Implying we're logged in and there's no log in button in DOM
$("#logInButton").on("click", () => {
alert("Hey!")
}); //Having this no error
document.querySelector("#logInButton").onclick = () => {
alert("Hey!")
} //Error "Uncaught TypeError: Cannot set property 'onclick' of null"