Skip to content

[07-usepopcorn]Issue with event listener cleanup in useEffect #58

@FoundDream

Description

@FoundDream

file: app-v3.js
line-179,180

The code snippet provided seems to have a problem with the cleanup of the event listener in the useEffect hook. In the cleanup function, the event listener is added again instead of being removed using removeEventListener. This can lead to unexpected behavior and potential memory leaks.

Proposed Solution: Modify the cleanup function in the useEffect hook to properly remove the event listener using removeEventListener. Also, include inputEl.current in the dependency array to handle changes to inputEl.current correctly.
issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions