UNPKG

@kadoui/react

Version:

Kadoui primitive components for React

16 lines (15 loc) 511 B
"use client"; import { jsx as _jsx } from "react/jsx-runtime"; import QRCode from "qrcode"; import { useEffect, useRef } from "react"; export function QrCode({ value, options = {}, ...p }) { const canvasRef = useRef(null); useEffect(() => { console.log(value); QRCode.toCanvas(canvasRef.current, value, options, function (error) { if (error) console.error(error); }); }, [value, options]); return (_jsx("canvas", { ref: canvasRef, ...p })); }