What is the best way to store SVG icons?
Answered
Vadym posted this in #help-forum
VadymOP
Hello everyone!
Currently I store my SVG icons into an object, like this:
This option easy to use but it doesn't easy when I've big amount of icons so it influences on my website performance.
I need an advice, how you guys store your icons. Thanks in advance!
Currently I store my SVG icons into an object, like this:
export const LogoIcons = {
facebook: (
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M13.5489 22V12.8777H16.6097L17.0689 9.32156H13.5489V7.05147C13.5489 6.0222 13.8336 5.32076 15.3112 5.32076L17.1928 5.31999V2.13923C16.8674 2.09695 15.7505 2 14.4505 2C11.7359 2 9.87739 3.65697 9.87739 6.69927V9.32156H6.80737V12.8777H9.87739V22H13.5489Z"
fill="currentColor"
/>
</svg>
),
// More icons here
}This option easy to use but it doesn't easy when I've big amount of icons so it influences on my website performance.
I need an advice, how you guys store your icons. Thanks in advance!
2 Replies
American Chinchilla
Store them seperately
American Chinchilla
Or use next/image with the svg
Answer