1.1.1 • Published 4 years ago

@feizheng/react-qrcode v1.1.1

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

react-qrcode

Qr code for react.

installation

npm install -S @feizheng/react-qrcode

update

npm update @feizheng/react-qrcode

properties

propertytypedefaultdescription
classNameString--
valueString--
optionsObject--

usage

  1. import css

    @import "~@feizheng/react-qrcode/dist/style.scss";
    
    // customize your styles:
    $react-qrcode-options: ()
  2. import js

    import ReactQrcode from '../src/main';
    import ReactDOM from 'react-dom';
    import React from 'react';
    import './assets/style.scss';
    
    class App extends React.Component {
      state = {
        value: 'https://www.baidu.com'
      };
    
      changeValue = () => {
        console.log('set new value!');
        this.setState({ value: 'https://www.mipengine.org/' });
      };
    
      render() {
        const { value } = this.state;
        console.log('value', value);
        return (
          <div className="app-container">
            <ReactQrcode value={value} />
            <button className="button" onClick={this.changeValue}>Regenerate</button>
          </div>
        );
      }
    }
    
    ReactDOM.render(<App />, document.getElementById('app'));

documentation

resources