react-qr-code

A lightweight React and React Native component that renders scannable QR codes as inline SVG.

Library
npm
v2.2.0
893stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
66/100Good
Development Activity68
Maintenance52
Community56
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
56/100Fair
Architecture78
Code Quality42
Innovation60
Learning Curve45

react-qr-code turns any string value into a scannable QR code component for React and React Native apps. It computes the QR matrix with the qrcode-generator library, encodes text in UTF-8 byte mode so non-Latin scripts and emoji scan correctly, and renders the result as an inline SVG on web or as react-native-svg primitives on iOS and Android from the same import path.

The API is intentionally small: a single required value prop plus optional size, bgColor, fgColor, and level props with sensible defaults, and full passthrough of any additional props onto the rendered SVG element. Prebuilt CJS, ESM, and native bundles ship in the package, so consumers add no build step of their own.

What You Get

  • A single <QRCode /> React component with TypeScript types (types/index.d.ts) declaring the full prop surface.
  • Automatic platform resolution: the same import resolves to an SVG-based renderer on web and a react-native-svg-based renderer on iOS/Android.
  • Prebuilt CJS, ESM, and native bundles (lib/index.js, lib/index.mjs, lib/index.native.js) generated via Rollup, so no build step is required by consumers.
  • UTF-8-safe text encoding out of the box, so callers don’t need a separate encoding step for non-Latin text or emoji.

Common Use Cases

  • App download and referral links surfaced as a scannable code on marketing pages.
  • Payment URIs, vCards, or Wi-Fi credentials shared between a screen and a phone camera.
  • Ticket, badge, and check-in codes generated per user for event or access-control flows.
  • Device pairing and two-factor setup codes scanned by a companion mobile app.

Under The Hood

Architecture The library has a single entry point, src/index.js, whose QRCode component is a stateless pipeline: it feeds value and level into qrcode-generator to produce a boolean matrix, walks that matrix into two SVG path-data strings (one for light cells, one for dark cells), and hands them to a separate QRCodeSvg rendering layer. That rendering layer exists in two parallel implementations, QRCodeSvg.js (a plain <svg>/<path> pair for web) and QRCodeSvg.native.js (react-native-svg’s <Svg>/<Path>), and Rollup’s @rollup/plugin-alias swaps one for the other when building the lib/index.native.js output. This cleanly separates platform-agnostic encoding from platform-specific markup, so the part most likely to break under a React Native SVG or browser SVG change is isolated to a single small file.

Tech Stack The runtime dependency surface is intentionally minimal: qrcode-generator for QR matrix computation and prop-types for runtime prop validation, with react (and, for native consumers, react-native-svg) left as peer dependencies. The build pipeline is Babel (preset-env, preset-react) driving Rollup 4, producing CJS, ESM, and native CJS bundles wired up through package.json’s exports map (react-native/import/require/types conditions). Linting runs on ESLint 9’s flat config with eslint-plugin-react and eslint-plugin-import, formatting via Prettier, and releases are cut with release-it plus conventional-changelog. A separate Expo/React Native app under demo/ exercises both the web and native renderers manually.

Code Quality No automated test suite exists in the repository — there are no *.test.* files, and verification of the native/web rendering paths is documented as a manual process using the demo/ app. Runtime prop validation is handled by prop-types rather than compile-time types in the source itself; the published TypeScript types (types/index.d.ts) are a hand-authored ambient module declaration layered on top of the plain JavaScript source, so they can drift from the implementation without a type-checking step to catch it. ESLint and Prettier are configured and enforced via lint script, and naming/prop-ordering conventions are consistent across the two component files, but the absence of any test coverage is the clearest quality gap.

API Design The public API is a single required value prop plus size, bgColor, fgColor, and level with defaults that work out of the box, and any additional props (style, aria attributes, an overriding viewBox) pass straight through to the rendered SVG element via forwardRef and prop spreading — the README documents concrete responsive-sizing and non-ASCII-text recipes built entirely on that passthrough. This keeps the barrier to first use very low, though the design itself — matrix-to-path-to-SVG — is the standard shape for QR React components and introduces nothing structurally new relative to comparable libraries in the ecosystem.

Used by 11 apps in this directory

TypeScript
96%
Other

Cal.diy

Scheduling

48,218

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
95
Repo Health
86
Technical
65
Dependency
Built with
TypeScript96%
Updated yesterday
TypeScript
91%
Apache 2.0

Helicone

Monitoring · AI Development · Analytics

6,133

An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.

View details
69
Repo Health
81
Technical
65
Dependency
Built with
TypeScript91%
Updated 1 weeks ago
PHP
58%
Other

Hi.Events

Ecommerce · Scheduling

4,015

Self-hosted event ticketing platform that keeps your attendee data, brand, and revenue completely under your control.

View details
89
Repo Health
84
Technical
66
Dependency
Built with
PHP58%
TypeScript36%
Updated yesterday
Clojure
55%
Other

Metabase

Analytics

49,109

The open-source BI platform that lets anyone ask questions and build dashboards without writing SQL — with an embedded analytics SDK and AI-powered query assistant included.

View details
95
Repo Health
84
Technical
65
Dependency
Built with
Clojure55%
TypeScript40%
Updated today
Go
56%
Other

Multica

AI Assistants · AI Development

49,056

Turn coding agents into real teammates — assign issues, track progress, and compound reusable skills across a vendor-neutral, self-hosted platform.

View details
85
Repo Health
83
Technical
69
Dependency
Built with
Go56%
TypeScript39%
Updated 2 days ago
TypeScript
98%
Other

Novu

Developer Tools

39,870

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript98%
Updated yesterday
TypeScript
82%
Apache 2.0

Palmr.

File Storage · Security

2,401

Self-hosted, privacy-focused file sharing without limits

View details
45
Repo Health
62
Technical
72
Dependency
Built with
TypeScript82%
MDX13%
Updated 6 months ago
Python
65%
Apache 2.0

Polar

Ecommerce · Developer Tools · Invoicing Finance

10,240

Open source payments infrastructure that turns software into a business — subscriptions, usage-based billing, digital products, and merchant-of-record compliance in one platform.

View details
90
Repo Health
82
Technical
69
Dependency
Built with
Python65%
TypeScript28%
Updated today
TypeScript
97%
AGPL 3.0

Swetrix

Analytics

1,191

Privacy-first, cookieless web analytics with error tracking, session replays, and performance monitoring — self-host or use Cloud.

View details
87
Repo Health
71
Technical
69
Dependency
Built with
TypeScript97%
Updated 3 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search