Linked Questions

Popular Questions

Dynamically create SVG React Component with SVGR

Asked by At

I am using SVGR in my React application to convert SVG's to React Components. This works very good.

However, I also want to investigate the opportunity to dynamically load SVG's passed by the user. So I'll get a string with SVG code in it and I want to get a React Component in return.

Looking at the guide of SVGR it appears that I can use the Node api (https://www.smooth-code.com/open-source/svgr/docs/node-api/) to convert it to jsCode. However, I don't want to eval this of course.

Is there a way to have the SVGR functionality but with a string as input?

Related Questions