Skip to content
Advertisement

ReactSVG and what’s the proper way to organize my current project

So I recently took over a project. the guy before me used SVG. my problem is those make the JSX document very hard to read. there are plenty of tags like the one below.

JavaScript

Originally this project was built using vanilla HTML, js, CSS, and I guess that’s probably why. my question is: what’s the correct react file organization? should I save all these paths into a different js file and import them? should I add import ReactSVG from 'react-svg' instead of using the tags? I am a bit confused about this

Advertisement

Answer

You can create custom folder in src for example icons if these svgs happens to be icons. And create q react component containing svg code in it.

JavaScript

And use this component in other ones

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement