Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react barcode scanner

import React, { Component } from 'react'import BarcodeReader from 'react-barcode-reader' class Test extends Component {  constructor(props){    super(props)    this.state = {      result: 'No result',    }     this.handleScan = this.handleScan.bind(this)  }  handleScan(data){    this.setState({      result: data,    })  }  handleError(err){    console.error(err)  }  render(){     return(      <div>        <BarcodeReader          onError={this.handleError}          onScan={this.handleScan}          />        <p>{this.state.result}</p>      </div>    )  }}
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #react #barcode #scanner
ADD COMMENT
Topic
Name
5+1 =