diff --git a/src/QrCode.tsx b/src/QrCode.tsx index b3958386..515234ab 100644 --- a/src/QrCode.tsx +++ b/src/QrCode.tsx @@ -30,25 +30,28 @@ export const QrCode: FC = ({ data, className }) => { const [url, setUrl] = useState(null); useEffect(() => { - let isCancelled = false; + let isCancelled = false; - toDataURL(data, { errorCorrectionLevel: "L" }).then((url) => { - if (!isCancelled) { - setUrl(url); - } - }).catch((reason) => { - if (!isCancelled) { - setUrl(null); - } - }); + toDataURL(data, { errorCorrectionLevel: "L" }) + .then((url) => { + if (!isCancelled) { + setUrl(url); + } + }) + .catch((reason) => { + if (!isCancelled) { + setUrl(null); + } + }); - return (): void => { isCancelled = true; }; + return (): void => { + isCancelled = true; + }; }, [data]); return (
- {url && {t("qr_code")}} + {url && {t("qr_code")}}
-); + ); }; -