Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsx code of svg render inaccurately #262

Open
YugdevEm opened this issue May 22, 2024 · 1 comment
Open

jsx code of svg render inaccurately #262

YugdevEm opened this issue May 22, 2024 · 1 comment

Comments

@YugdevEm
Copy link

i am working on a project where i access a svg image from the user,convert the svgcode of image to jsx in the nodejs server and show the svg image using this jsx in the front end.To do this i need to render the jsxCode inside a react component,the jsxCode is stored inside a variable.The svg image is being rendered inaccurately,the colours are inaccurate and alignment of the text elements are broken.why am i facing this issue?

i also need to make changes to the svg like adding a new path element,change colours of the path etc.
 Image

Do any of you know how to fix this?

@TroyAlford
Copy link
Owner

@YugdevEm I can't give you any advice, there, without seeing the content of your SVG. My guess, however, is that SVG has a set of elements within it that React may not like without alteration. Specifically, this could include namespaces inside the tag names, casing in tags, or things spelled via kebab-case rather than camelCase or PascalCase which React expects.

If you get any errors in your console, I'd suggest starting there. You're also welcome to post the text of your SVG here, if you wish -- I may be able to spot something there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants