Home / Article Detail

The nextjs13 click-to-pass dom gives a function to write.

📅 Oct 18, 2023✍️ lllomh
    nextjs13 Ways to pass a dom to a function on a click

    Passing the current element focuses on currentTarget. If target is used directly, it passes the element inside the current element.

    <div className="headerTrigger">
    <span className="trigger" onClick={(event) => f_nav(event.currentTarget)}>
    <span></span>
    <span></span>
    <span></span>
    </span>
    </div>