so I have around 40 svgs in my frontend in seperate files, and I have an api route that gives me the name of the svg on request to I can import it, but I'm not quite sure how to dynamically import these svgs in react right now
I tried this but it means I can't change styles of svgs if I render them in img tag
export const renderIcon = ({ name, folder }) => {
return <img src={`/${folder}/${name}.svg`} alt="" />;
};
is there a better way of doing this?
context:
basically name just returns the name of the svg and folder is only either "outline" or "filled", I was trying to find a way to return the svg from this file but i couldn't so i was trying the img instead.