useNodeRegistration = (ref, onNodeRegister, id) => {
  const { canvas, nodes } = useContext(DiagramContext);

  useEffect(() => {
    if (onNodeRegister && ref.current && canvas && nodes && !nodes[id]) {
      onNodeRegister(id, ref.current);
    }
  }, [ref.current, onNodeRegister, !!canvas, !!nodes, id]);
}
Takes a dom reference and an onNodeRegister callback and perform the callback when the node is mounted
and the canvas is ready