|
const svgCanvas = React.createRef<CanvasRef>(); |
exportSvg() sometimes throws with Export function called before canvas loaded because svgCanvas.current is null - this is due to the usage of createRef which creates a new ref every time the component is rendered.
Suggested fix: replace createRef with useRef
react-sketch-canvas/packages/react-sketch-canvas/src/ReactSketchCanvas/index.tsx
Line 50 in bcbb141
exportSvg()sometimes throws withExport function called before canvas loadedbecausesvgCanvas.currentisnull- this is due to the usage ofcreateRefwhich creates a new ref every time the component is rendered.Suggested fix: replace
createRefwithuseRef