Eliav2 / react-xarrows

Draw arrows (or lines) between components in React!
https://codesandbox.io/embed/github/Eliav2/react-xarrows/tree/master/examples?fontsize=14&hidenavigation=1&theme=dark
MIT License
584 stars 75 forks source link

I want to call useXarrow with onClick #141

Closed AdarshPawar29 closed 1 year ago

AdarshPawar29 commented 2 years ago

I'm trying to make a connection between two trees with their nodes. I can also have expanded and collapsed functionalities when the user clicks the node. I want to update the position of lines when there is any click/change event taking place. I tried to do this behaviour using setTimeout and it works as expected, but it makes my component keep re-rendering.

https://codesandbox.io/s/sharp-wildflower-mit5wp?file=/src/TreeMapView.tsx

Eliav2 commented 1 year ago

settimeout wont help you here. you need to call 'updateXarrow' when animations finished and not onClick, because after a click the positions shift