feat(edge-labels): add div based renderer
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { useRef } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
function EdgeLabelRenderer({ children }: { children: ReactNode }) {
|
||||
const wrapperRef = useRef(document.getElementById('edgelabel-portal'));
|
||||
|
||||
if (!wrapperRef.current) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return createPortal(children, wrapperRef.current);
|
||||
}
|
||||
|
||||
export default EdgeLabelRenderer;
|
||||
Reference in New Issue
Block a user