Warning: Maximum update depth exceeded

I am trying to display a hierarchy accompanied with checkboxes, in Canvas element.

In order to do that, I have a recursive function drawItem in my main App.js file that display my hierarchy.

I have implemented a useCanvas hook that return the canvas attribute. For instance, the handleCanvasClick function is deserved to handle clicks on Canvas element and detect if one of the checkboxes has been clicked.

So far, my architecture seems good to me. Despites, Reacts shows me ‘Warning: Maximum update depth exceeded.’ on browser console. Have you any improvement to implement in a better manner ?

See code at https://codesandbox.io/s/ybdyik