Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Creating QR Code in React
Chetan Rohilla
Chetan Rohilla

Posted on • Edited on • Originally published atw3courses.org

     

Creating QR Code in React

QR Code stands for “quick response” code. It is capable of storing lots of data. It is basically a barcode on steroids. While the barcode holds information horizontally, the QR code does so both horizontally and vertically. When we scans the QR code we can access the information immediately. Here we will see how to create QR Code in react websites or react native apps, the approach will be same for both React JS website and React Native by using the node package.

Create QR Code in React

Here we will usereact-qr-code node package. It is basically a component for creating QR Code. This library works with React and React Native. You can read about thispackage here.

Installation – QR Code Package in React

yarn add react-qr-code
Enter fullscreen modeExit fullscreen mode

When using this library with React Native, you will also need to havereact-native-svg installed.

Using QRCode Component in React

Now, we have Component. We can use this easily by importing and passing some props. Here below is an example usage.

importReactfrom"react";importReactDOMfrom"react-dom";importQRCodefrom"react-qr-code";ReactDOM.render(<QRCodevalue="hey"/>,document.getElementById("Container"));
Enter fullscreen modeExit fullscreen mode

We have also someprops like bgColor, fgColor, level, size, title and value, read indetail here. And After Implementation you will get result like the image showing below.

QR Code in React

Please like share and give positive feedback to motivate me to write more for you.

For more tutorials pleasevisit my website.

Thanks:)
Happy Coding:)

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

FullStack Developer
  • Location
    New Delhi, India
  • Education
    NEW DELHI
  • Work
    FULLSTACK DEVELOPER
  • Joined

More fromChetan Rohilla

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp