
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
react-qr-code
Advanced tools
A component for React. This library works with React and React Native (using React Native SVG).
npm i react-qr-code
When using this library with React Native, you will also need to have react-native-svg installed.
npm i react-native-svg
cd ios && pod install
import React from "react";
import ReactDOM from "react-dom";
import QRCode from "react-qr-code";
ReactDOM.render(<QRCode value="hey" />, document.getElementById("Container"));
Note: If the QR code is likely to appear next to dark objects, you will need to wrap it in a light-colored container to preserve the 'quiet zone', e.g.
<div style={{ background: 'white', padding: '16px' }}>
<QRCode ... />
</div>
Responsive QR code example:
// Can be anything instead of `maxWidth` that limits the width.
<div style={{ height: "auto", margin: "0 auto", maxWidth: 64, width: "100%" }}>
<QRCode
size={256}
style={{ height: "auto", maxWidth: "100%", width: "100%" }}
value={value}
viewBox={`0 0 256 256`}
/>
</div>
| prop | type | default value | platform |
|---|---|---|---|
bgColor | string | '#FFFFFF' | web, ios, android |
fgColor | string | '#000000' | web, ios, android |
level | string ('L' 'M' 'Q' 'H') | 'L' | web, ios, android |
size | number | 256 | web, ios, android |
title | string | web | |
value | string | web, ios, android |
Adheres to the official QR spec and can store up to 2953 characters in value.
MIT
qrcode.react is another popular React library for generating QR codes. It offers similar functionality to react-qr-code, including the ability to customize the size and colors of the QR code. However, qrcode.react provides additional features such as error correction levels and support for rendering QR codes as SVG elements.
react-qr-svg is a React component for generating QR codes as SVG elements. It provides similar functionality to react-qr-code but focuses on rendering QR codes as scalable vector graphics (SVG). This can be beneficial for applications that require high-quality, scalable QR codes.
react-qr is a lightweight React component for generating QR codes. It offers basic QR code generation functionality similar to react-qr-code but with fewer customization options. It is suitable for simple use cases where minimal configuration is needed.
FAQs
A QR code generator for React and React Native.
The npm package react-qr-code receives a total of 913,167 weekly downloads. As such, react-qr-code popularity was classified as popular.
We found that react-qr-code demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.