qrs
5.0/51
qrscan
npm i qrscan
qrs

qrscan

QR scanner for React

by Louis Merlin

1.0.6 (see all)License:MITTypeScript:Not FoundCategories:React QR Code Scanner
npm i qrscan
Readme

qrscan

QR scanner for React

See a simple demo here.

Installation and usage

First, install the component from npm.

yarn add qrscan

Then, use it in your app.

import React, { Component } from 'react'
import QRScan from 'qrscan'

class App extends Component {
  
  constructor (props) {
    super(props)
    this.state = { value: '', watching: false }
    this.onFind = this.onFind.bind(this)
  }
  
  onFind (value) {
    this.setState({ value, watching: false })
  }
  
  render () {
    return (
      <Fragment>
        <h1>QRScan Demo</h1>
        {this.state.watching
          ? (
            <QRScan onFind={this.onFind} />
          )
          : (
            <Fragment>
              <button onClick={() => this.setState({ watching: true })}>Scan</button>
              <h4>value: {this.state.value}</h4>
            </Fragment>
          )
        }
      </Fragment>
    )
  }
}

Props

The QRScan component takes as props:

  • onFind - subscribe to qr code detection
5.0/ 5
1
Rate
5
1
4
0
3
0
2
0
1
0
Poor Documentation1

Downloads/wk

258

GitHub Stars

2

LAST COMMIT

4yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
1.0.6
latest
4yrs ago

Rate & Review

100