Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
useDeepCompareEffect(() => {
const rendererElement = ref && ref.current;
const renderer = getRenderer();
if (!rendererElement) return;
if (renderer === 'svg') {
const roughSvg = new RoughSVG(rendererElement as SVGSVGElement, config);
const node = render(roughSvg) as Node;
rendererElement.appendChild(node);
return (): void => {
rendererElement.removeChild(node);
};
} else {
const roughCanvas = new RoughCanvas(
rendererElement as HTMLCanvasElement,
config
);
render(roughCanvas);
}
}, [ref, render]);