diff --git a/src/useBackground.tsx b/src/useBackground.tsx index 216a80f..c6594a9 100644 --- a/src/useBackground.tsx +++ b/src/useBackground.tsx @@ -47,27 +47,29 @@ const useBackground = ({ setBackground(generateBackground()); }; - const svgWidth = Math.ceil((width ?? 1920) * ratio); - const svgHeight = Math.ceil((height ?? 1080) * ratio); - const noise = ( - - - - - - - - - ); + const noise = useMemo(() => { + const svgWidth = Math.ceil((width ?? 1920) * ratio); + const svgHeight = Math.ceil((height ?? 1080) * ratio); + return ( + + + + + + + + + ); + }, [width, height, ratio]); return { regenerate,