You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Beautiful library, it actually works... and then...
The only way to use the SVG that it creates with React is with dangerouslySetInnerHTML! Nooooo! :)
These days one has to be mindful about the potential for supply chain attacks especially with npm packages these days so that makes it hard to use this library as published. I suppose one could add DOMPurify or work with a fork since you published as MIT (thank-you!).
Suggestions --
An option to get an SVG data URL to load into an image tag would be a nice feature request.
QRSvg.ts could be split up as helpers so a React component could import and use them and do that final step of constructing the SVG element.
This would also make it nicely (and safely!) compatible with pretty much any UI framework and vanillajs.
I think this step of the svg() method should be something that downstream consumers of the library should be able to do on their own. This will also enable them to easily add things like <title>, omit a hardcoded width and height for fluid/responsive sizes driven by css, and other tidbits to meet various requirements.
Beautiful library, it actually works... and then...
The only way to use the SVG that it creates with React is with
dangerouslySetInnerHTML
! Nooooo! :)These days one has to be mindful about the potential for supply chain attacks especially with npm packages these days so that makes it hard to use this library as published. I suppose one could add DOMPurify or work with a fork since you published as MIT (thank-you!).
Suggestions --
An option to get an SVG data URL to load into an image tag would be a nice feature request.
QRSvg.ts
could be split up as helpers so a React component could import and use them and do that final step of constructing the SVG element.This would also make it nicely (and safely!) compatible with pretty much any UI framework and vanillajs.
I think this step of the
svg()
method should be something that downstream consumers of the library should be able to do on their own. This will also enable them to easily add things like<title>
, omit a hardcodedwidth
andheight
for fluid/responsive sizes driven by css, and other tidbits to meet various requirements.Right now its not possible because of how QRSvg is implemented as a class.
I suppose you could always publish a React component too since the "guts" are practically already there!
I imagine you created this library for a project you were working on, so thank-you kindly for taking the time to publish and share it to the world.
The text was updated successfully, but these errors were encountered: