0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-09 00:28:20 -05:00

Use properly the react hook

We can't use hooks in a condition, the condition should be inside
the hook.
This commit is contained in:
Andrey Antukh 2022-07-28 09:36:52 +02:00
parent d2aa985714
commit 9263f70d6a

View file

@ -70,9 +70,10 @@
(when (and (some? dom) (some? submenu-node))
(dom/set-css-property! submenu-node "top" (str (.-offsetTop dom) "px"))))))]
(when on-unmount
(mf/use-effect
(fn [] on-unmount)))
(mf/use-effect
(mf/deps on-unmount)
(constantly on-unmount))
(if icon
[:li.icon-menu-item {:ref set-dom-node