The "best" way to manage icons in React.js
If you have been building user interfaces for any amount of time, you know that icons are, well, they are everywhere. I have spent the last 7 years building UIs with React.js and I have tried a number of different techniques for managing icons. Each technique has different tradeoffs. The main techniques I have used are: TLDR - Inline SVGs using sprites gives you the best performance to experience tradeoff. The big tradeoffs we are evaluating are performance vs. user experience. Before you hit me with a “well ackchyually, performance is a part of user experience”, I know ( I agree), let’s keep moving. When using the first approach I mentioned, an image tag referencing an image asset (png, svg, etc.), the first time the page is downloaded there is a flicker before the icons render. This happens because of a request waterfall. First the Browser downloads the HTML document. It then makes the subsequent requests to fetch all the assets for the page (images, scripts, stylesheets, etc). The b
The "best" way to manage icons in React.js Icon Rendering Techniques If you have been building user interfaces for any amount of time, you know that icons are, well, they are everywhere. I have spent the last 7 years building UIs with React.js and I have tried a number of different techniques for managing icons. Each technique has different tradeoffs. The main techniques I have used are: Image + SVG < img src = 'icon.svg' > Inline SVG const icon = ( < svg viewBox = "0 0 24 24" width = { 16 } height = { 16 }> < path d = "M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2
Explore this link on the map →related reading
- GitHub - tailwindlabs/heroicons: A set of free MIT-licensed high-quality SVG icons for UI development. · GitHubgithub.com
- Grainradgrainrad.com
- It’s hard to justify Tahoe icons @ tonsky.metonsky.me
- Free SVG Icons - 300,000+ Open Source Icons | Iconbuddyiconbuddy.com
- Line Awesome — Free Beautiful Icon Fonticons8.com
- React Iconsreact-icons.github.io
- The Conductor Rewrite: What They Changed to Make It Fastperformance.dev
- Making Sense of React Server Components • Josh W. Comeaujoshwcomeau.com
- Blogged Answers: A (Mostly) Complete Guide to React Rendering Behavior · Mark's Dev Blogblog.isquaredsoftware.com
- Tutorial: Tic-Tac-Toe – Reactreactjs.org
- Magical SVG Techniques — Smashing Magazinesmashingmagazine.com
- React graph viscrubier.github.io