React Code Scanner is a React Component to Scan QR and Barcodes.
npm i @tarek-laun/react-code-scanner
import React, { useState, useRef } from "react";
import ReactCodeScanner from "reactcode";
import styles from "../styles/Home.module.css";
function Scan() {
const [data, setData] = React.useState("Not Found");
return (
<>
<ReactCodeScanner onScan={(error: any, output: any) => {
if (!error)
setData(output.text);
}}>
</ReactCodeScanner>
<p>{data}</p>
</>
);
}
export default Scan;
©Tarek Laun