📌  相关文章
📜  如何仅在单击父组件外部而不是 React js 中的子组件时触发模糊 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:21.156000             🧑  作者: Mango

代码示例1
// assign handleBlur to parent's onBlur i.e. 
handleBlur(event) {
    // currentTarget is the parent element, relatedTarget is the clicked element
    if (!event.currentTarget.contains(event.relatedTarget)) {
        // code when clicked outside parent and children components
    }
}