Skip to content

Tarek-Laun/React-Code-Scanner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React-Code-Scanner

React Code Scanner is a React Component to Scan QR and Barcodes.

Installation

npm i @tarek-laun/react-code-scanner

Example

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

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%