zmp-qrcode
Version:
React component for generating QR Code that match Zalo Miniapps looks and feels.
52 lines (36 loc) • 1.08 kB
Markdown
React component for generating QR codes that match Zalo Mini App looks and feels.
```bash
npm i zmp-qrcode
```
```jsx
import { QRCode } from 'zmp-qrcode'
<QRCode value="https://www.npmjs.com/package/zmp-qrcode" />
```

|Name|Description|Default|
|--- |--- |--- |
|value*|string|-|
|size|number|128|
You can export the QR code as a base64 image using ref. Here is an example:
```jsx
export const Base64 = (args) => {
const ref = useRef<QRCodeInstance>()
const [src, setSrc] = useState('');
return <div>
<QRCode ref={el => el ? setTimeout(() => setSrc(el.getBase64()), 1000) : el} {...args} rounded />
<img src={src} alt="" />
</div>
}
```
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
[](https://choosealicense.com/licenses/mit/)