Lightning Web Component: Create a QR Code Generator using ES6 code (Approach 2)

Lightning Web Component: Create a QR Code Generator using ES6 code (Approach 2)

In the previous blog post, you learned how to generate your QR code using Google APIs. However, there are instances when businesses prefer not to rely on any external APIs and opt to keep everything in-house.

This approach is chosen to mitigate the risk of API deprecation. In this blog post, we will show you how to create a QR code within Salesforce Lightning Web Components using ES6 code.

  1. Create a Lightning Web Component (LWC).

  2. Within the same folder as your LWC, add a module named "qrcode.js."

  3. Now, insert the following code into the "qrcode.js" file.

Folder Structure.

qrcode.js

qR_Code_Generator_LWC.html

qR_Code_Generator_LWC.js

qR_Code_Generator_LWC.js-meta.xml

Output

QR Code Generated as you type. Scan With Your Mobile.
The link opened automatically after the scan.

Congratulations! You've now successfully generated a QR code within your Lightning Web Component (LWC). Give it a try and share your feedback with me. I'd love to hear about your experience!

Hi Gaurav Gupta - This option is not working for iOS devices . Qr code is not getting generated for IOS devices, browser and android devices works fine.

Like
Reply

To view or add a comment, sign in

Others also viewed

Explore topics