qr-code-react

1.1.6 • Public • Published

qr-code-react

==========

This is an npm module ported from HERE to work for React.

This was to fix the issues involving dangerouslySetInnerHTML.

Examples

import QRcodeReact, { qrcode } from 'qr-code-react';
 
// Inside a react component:
render() {
  return (
    <div className="App">
      <QRcodeReact
        className="LOL"
        value="Hello World!"
        margin={40}
        size={10}
        codeType={4}
        errorLevel="M"
        color="#000000"
        bgColor="#FFFFFF"
      />
    </div>
  );
}
 
 
// Or just use the original code:
let qr = qrcode(4, 'M');
qr.addData("Hello World!");
qr.make();
 
qr.createImgTag(4);    // creates an <img> tag as text
qr.createTableTag(4);  // creates a <table> tag as text

Details

static propTypes = {
  className:  PropTypes.string.isRequired,
  margin:     PropTypes.number,
  size:       PropTypes.number,
  codeType:   PropTypes.number,
  errorLevel: PropTypes.string,
  value:      PropTypes.string.isRequired,
  color:      PropTypes.string,
  bgColor:    PropTypes.string
};
 
static defaultProps = {
  margin:     2,
  size:       4,
  codeType:   4,
  errorLevel: "M",
  color:      "#000000",
  bgColor:    "#FFFFFF",
};
  • typeNumber: 1 to 10
  • errorCorrectLevel: 'L','M','Q','H'

Install

npm install qr-code-react

NOTICE

The word "QR Code" is registered trademark of DENSO WAVE INCORPORATED

Package Sidebar

Install

npm i qr-code-react

Weekly Downloads

4

Version

1.1.6

License

ISC

Last publish

Collaborators

  • oconnorct1