React app - how to use webcam to scan barcodes
To use camera in web React to scan barcodes follow below steps:
1] install below module:
npm install react-webcam-barcode-scanner
2] import webcam module
import BarcodeScannerComponent from "react-webcam-barcode-scanner";
3] we Will use this in functional component so declare data object that will get barcode text with useState:
const [data, setData] = React.useState("Nie ma kodu");
4] render our scanner component
{ <BarcodeScannerComponent
        width={500}
        height={500}
        onUpdate={(err, result) => {
          if (result) setData(result.text);
        //   else 
        //   setData("Not Found");
        }}
      />
      <p>{data}</p> */}
It work’s only with https. That’s all!
 
      