Reuse the context

This commit is contained in:
Gender Shrapnel 2020-08-23 05:24:20 +02:00
parent b21a0f82d0
commit 0d8bbe563a

View File

@ -20,7 +20,7 @@ function SystemCanvas({ height, width, children }: SystemCanvasProps) {
const context = canvasRef.current.getContext("2d") const context = canvasRef.current.getContext("2d")
setContext(context) setContext(context)
} }
}, [frameCount]) }, [canvasRef.current])
React.useEffect(() => { React.useEffect(() => {
const frameId = requestAnimationFrame(() => { const frameId = requestAnimationFrame(() => {