use-barcode
v1.0.0
Published
React custom hook to read barcode from scanner
Downloads
7
Maintainers
Readme
use-barcode
Installation
yarn add use-barcode
# or
npm install use-barcode
Usage
import useBarcode from 'react-barcode';
useEffect(() => {
if (barcode) {
// do your own logic
}
}, [barcode]);
The above useEffect
will be performed after scanned anywhere on the page, except for input
, textarea
and any elements with contenteditable
attribute.
Refer to Demo.js for more details.
Reference
- https://github.com/kciter/react-barcode