Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I did not understand the event handler part. Could you make an example?


    const myHandler = function (event) {
        console.log(event.target);
    };
    
    // this is simple and easier to troubleshoot,
    // but you can only directly assign one value to an object property
    myNode.onclick = myHandler;
    
    // for pages with JavaScript code from third party domains
    // use event listeners instead
    myNode.addEventListener("click", myHandler);
When leaving frameworks you have to stop thinking in terms of components, isolated code islands that exist only in their own isolated world. Instead think of areas of the page as parts of a larger whole. You can manage each part independently or not. You wouldn't program outside the browser using something like React, so your programming inside the browser should reflect how you would build an application if the browser weren't there.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: