import { toString } from 'qrcode'; import { Suspense, use } from 'react'; import { cx } from '../../utils/styleUtils'; import style from './QrCode.module.scss'; interface QRCodeProps { value: string; size: number; } export default function QRCode({ value, size }: QRCodeProps) { 'use memo'; const svgPromise = toString(value, { width: size, margin: 2, color: { dark: '#101010', light: '#cfcfcf' }, }); return ( }> ); } function QrFallback({ size }: { size: number }) { 'use memo'; return ; } function QrSvg({ svgPromise, size }: { svgPromise: Promise; size: number }) { 'use memo'; const svg = use(svgPromise); return ( ); }