React Icons — React Technical Interview Questions & Answers
React Icons
React Icons
- react-icons (and similar) export SVG components. Import one icon, not the whole pack, or the bundle grows. Give aria-label if there’s no visible text. PNG sprites are last century for UI icons.
- React Icons — on screen: heart icon. Tree-shake by importing one icon, not the whole pack.
Technical Interview Tip: Tree-shake icons. Label them.
Code Examples for React Icons
Example
// react-icons
import { FaHeart } from "react-icons/fa";
export default function Like() {
return <FaHeart aria-label="like" />;
}
React Icons — on screen: heart icon. Tree-shake by importing one icon, not the whole pack.
How to Explain React Icons to an Interviewer
Explain React Icons as if you are teaching a junior — definition, then one tiny UI.
Import one icon. SVG component.
What does the example show on screen (or print), and what does that prove?
React Icons — on screen: heart icon
What mistake do freshers make with React Icons?
A11y : label.