SVG Components in React

preview_player
Показать описание
#SVG is great as you get to scale it without loss of quality. In this lesson we look at various ways you can use SVG in #React and then we also look at #SVGR to automate the creation of components for us. We are using #TypeScript but this will work with #JavaScript as well 🌹

This lesson was requested in the comments. If you have a lesson request, leave it below ❤️

#basarat #svg #react #tutorial

In this lesson
0:00 Intro
0:12 Export SVG
0:22 Built in Support
1:14 Create Components
2:32 Automating Component Creation
3:40 Use SVG as Font
4:40 Outro

👇 SUBSCRIBE for MORE 👇

**Feel Free To Read This Lot**

I'm Basarat, That TypeScript Guy and I love helping developers. More about me:

Microsoft MVP for TypeScript
Lead Frontend Practice at Australia Post
150K contributions on Stackoverflow. Top Contributor for TypeScript.
Book Author : Beginning NodeJS
Book Author : TypeScript Deep Dive
Creator of multiple hot ✨ed Github Open Source projects

Рекомендации по теме
Комментарии
Автор

What a tutorial man! so easy explanation, Subscribed 👍

rakshitlakhatariya
Автор

Thank youuu sooo much mann, you saved a lot of time

leofoster
Автор

How you can be so smart about everything? Thank you very much

en_kratia
Автор

Thank you for the help. Easy explanation with powerful results!

totiruiz
Автор

ur voice makes my soul calm af, and btw thanks for the tutorial

atalyy
Автор

hi basarat, may i ask about how to use the <svg><use></use></svg> this tag in reactjs and modify the svg size

烟幕-ie
Автор

How to make it dynamic like where we can select edit, add and add elements to SVG ?

jeevandza
Автор

Great explanation my friend, thank you very much for sharing.

alejandrolopez
Автор

that’s a delightful explanation, thanks you. I have a question, is it possible to make the imported svg icon clickable just like we add onClick event?

pronatalia
Автор

Fantastic 👌 like how you showed the different ways to do it.

Norfeldt
Автор

Command "npx @svgr/cli" is a life saver! Thank you man🙏

АндрейНосов-иу
Автор

Really clear and helpful.

Everything worked on my side

Thank you my friend.

fredericwatare-officiel
Автор

how can i use the @svgr with yarn? running the same command with 'yarn add' returned a error Command failed

thiagolinhares
Автор

you can also just do the following without needing to make a react component for every icon you want:

import { ReactComponent as IconName } from '../path/img/icon.svg';

<IconName />

kyle
Автор

please make a vedio on nextjs and typescript project

tarunsikarwar
Автор

Thank you this was very helpful. I would like to know how to dynamically change "fill" property of multiple svg elements (eg. change the "fill" property of multiple circle elements in a SVG image)

anand_maurya