A modern React application for handling QR codes. The project combines generation, scanning, and history storage functionalities, built with Vite for maximum performance.
You can see the project live here: [https://bindasdanylo30.github.io/QrCode_React/]
Core:
- React (Hooks:
useState) - Vite — Fast build tool and development server.
- React Router DOM — SPA routing for navigating between scanner, generator, and history.
Styles:
- SCSS (Sass) — Used preprocessor for variables, nesting, and mixins.
- CSS Modules — Implemented a modular styling approach to ensure component isolation and prevent global namespace pollution.
QR Logic:
- react-qr-code — Component for generating QR codes.
- react-qr-scanner — Device camera integration and decoding logic.
Storage & Data:
- LocalStorage API — Persists scanning and generation history.
- JSON Handling — Usage of
JSON.stringifyandJSON.parsefor data serialization.
The project is deployed to GitHub Pages.
To ensure proper routing and asset loading in the production environment, I implemented specific Vite configuration:
- Base Path: Configured the
baseproperty invite.config.js(e.g.,base: '/repo-name/'). This ensures that assets (CSS, JS, Images) are linked correctly relative to the repository path, fixing the common "blank screen" issue on GitHub Pages. - Build Script: Optimized the
npm run buildcommand to generate a production-readydistfolder.
The user can enter any text or link, and the application will instantly generate the corresponding QR code.
Access to the device camera is implemented. The application recognizes QR codes in real-time and decodes their content.
One of the key features is the preservation of user actions:
- All generated and scanned codes are stored in LocalStorage.
- Data persists across page reloads.
- Implemented complex data structure handling using
JSON.stringify()for serialization andJSON.parse()for retrieval.
The project uses a component-based approach. The interface is divided into independent reusable blocks:
Navigation— Routing menu component.Generate— Logic for input and code rendering.GenerateHistory— Component for displaying saved generation records.Scanner— Camera and scanning logic.ScanHistory— Component for displaying saved scan records.
The project is built on Vite, so it launches very quickly.
- Install dependencies:
npm install