Add more memoization hooks.

This commit is contained in:
Andrey Antukh 2020-04-11 10:20:31 +02:00 committed by Alonso Torres
parent 162fe5219c
commit 032252469b
3 changed files with 84 additions and 72 deletions

View file

@ -25,8 +25,12 @@
[props]
(let [shape (unchecked-get props "shape")
frame (unchecked-get props "frame")
on-mouse-down #(common/on-mouse-down % shape)
on-context-menu #(common/on-context-menu % shape)]
on-mouse-down (mf/use-callback
(mf/deps shape)
#(common/on-mouse-down % shape))
on-context-menu (mf/use-callback
(mf/deps shape)
#(common/on-context-menu % shape))]
[:g.shape {:on-mouse-down on-mouse-down
:on-context-menu on-context-menu}
[:& rect-shape {:shape (geom/transform-shape frame shape) }]]))