课程: React.js: Building an Interface

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Using React icon components

Using React icon components

- [Tutor] In a real project, you will want to do all the work yourself. So, let's take a look at how we can install a module that is external to help us add icons to our project. Now the one I'm going to be using is called React Icons, and it's one of my favorite React Component Libraries. To install it, we're going to issue an npm install command, and use react-icons, and then save it as a dependency. So, I'll just copy this code right here, from the slide and then go into my terminal, in my project, and go ahead and paste it in there, and run it. Once you've done that, you can use it in any one of your modules, which is pretty cool. Now, to use that, you're going to need to have the import command with the icon that you want to import. So, one of the cool things about React Icons is that it'll only insert the code for the icon that you need. So, you won't, unlike something like Font Awesome if you install it normally,…

内容