import * as React from 'react' ; import { toCanvas as qrToCanvas } from 'qrcode' ; function QRCode ( { text } ) { const canvasRef = React . useRef < HTMLCanvasElement > ( null ) ; React . useEffect ( ( ) => { void qrToCanvas ( canvasRef . current , text ) ; } , [ text ] ) ; return < canvas ref = { canvasRef } />; } export default QRCode ;