react
react copied to clipboard
Export the SVG files
Is there any way to import the SVGs directly from phosphor-react
? I looked in the other Phosphor packages but couldn't find a way. For those using Next.js with SVGR this would allow such usage with dynamic import.
const svg = {
heart: dynamic<SVGProps<SVGSVGElement>>(() =>
import('phosphor-react/svgs/heart.svg').then((mod) => mod.ReactComponent)
),
...
}
const Icon = ({ icon, ...props }) => {
const Svg = svg[icon];
return <Svg {...props} />;
};