Svg Icons For React. When using the SVG inline in HTML this shouldnt be a problem but when using it as an image the attribute is needed. Adding SVG icons with react-icons Adding react-icons to your project.
With the SvgIcon component a React wrapper for custom SVG icons. Const Icon name color size Iconsicon- name. SVG icon systems are beautifully simple and easily extendable in React have less HTTP requests and are easy to maintain in the future due to the fact that we can completely update the output in the future without any repetitive markup changes.
Yarn add react-icons or npm install react-icons --save Once its completed we should be ready to use it in our project.
Inside of your project run the following command. Import Icons from assetsiconsiconssvg. Inside of your project run the following command. Const Icon name color size Iconsicon- name.