+ 1
react-signature-canvas is not loading with fromDataURL function within UseEffect Hook
react-signature-canvas (npm) take time to load when calling it with the signature.current.FromDataURL function. I have used a set Timer within the react use effect Hook. Is there any other best practices I can use instead of set Timmer within useEffect? const sigCanvas = useRef<SignatureCanvas>({} as any); useEffect(() => { setTimeout (()=>{ if (Object.keys(sigCanvas) && props.isSignaturePadOpen) { sigCanvas.current.fromDataURL(props.attendeeSignature); } },1000) }, [sigCanvas,props.attendeeSignature,props.isSignaturePadOpen])
2 Réponses
+ 1
Can you share piece of code please?
0
Added the code