React custom hook for barcode scanner integration.
Installation
npm install @ombori/ga-barcode-scanner --save
or
yarn add @ombori/ga-barcode-scanner
Usage
import useBarcodeScanner from '@ombori/ga-barcode-scanner';
const App = () => {
const onScan = (barcode) => console.log(barcode);
useBarcodeScanner(onScan);
return <div>Hello World!</div>;
}
Helpers
There are also two helper functions that you can use to differentiate barcodes and boarding passes.
import { isBarcode, isBoardingPass } from '@ombori/ga-barcode-scanner';