简体   繁体   English

有什么快速的方法可以用来在单行中导入 React.js 材质图标吗?

[英]Is there any fast way I can use to import React.js Material Icons in just Single line?

I was working on my first react.js project as beginner & I got annoyed by the fact that I have import material UI icons one-by-one & that made my code look really really long & I had to keep on visiting browser, COPY the Icon link again & again.作为初学者,我正在开发我的第一个 react.js 项目,我对我一个接一个地导入材料 UI 图标这一事实感到恼火,这让我的代码看起来真的很长,我不得不继续访问浏览器,COPY图标链接一次又一次。 So I was wondering if there's a way I can use to just group together all the Icons that I need from Material UI & just import one line of code containing all the Icons I need?.所以我想知道是否有一种方法可以用来将 Material UI 中我需要的所有图标组合在一起并导入包含我需要的所有图标的一行代码?

Yes:是的:

import { AccessAlarm, ThreeDRotation } from '@material-ui/icons';

So you just make a list of the ones you want.所以你只需列出你想要的那些。 This is from the documentation option #2.这是来自文档选项#2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM