79076844

Date: 2024-10-11 04:59:11
Score: 1
Natty:
Report link
firstUpdated(){
    window.addEventListener('mousedown', this.handleClickOutside);
  }

  handleClickOutside = (e) => {
    if(!this.contains(e.target)){
      this.activeList = false;
    }
}

Use arrow functions, if you use normal functions the context of "this" is a window object

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Yeric Fonseca