onClose props was called twice, when user closes popup: in a moment of the click, and later in useEffect's cleanup. Also it was called, when popup was closed from the external element, not one of: backdrop, close btn, esc button
Changes:
onClose props called only on interaction with closing element (backdrop, close btn, esc button)
all setups/cleanups that needs for correct popup work, are done in useEffect, that depends on isOpen value
Issue:
onClose props was called twice, when user closes popup: in a moment of the click, and later in useEffect's cleanup. Also it was called, when popup was closed from the external element, not one of: backdrop, close btn, esc button
Changes: