如何在 React 中使用 Material UI 图标? [英] How to use Material UI icons in React?

查看:107
本文介绍了如何在 React 中使用 Material UI 图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 React 的新手,正在研究现有的 React 组件.我需要包含一个图标,并注意到一些已经被引入,例如:

I'm new to react and am working on an existing React component. I need to include an icon and noticed that some were already being brought in, like:

import KeyboardArrowLeftIcon from 'material-ui/svg-icons/action/keyboard-arrow-left';

我找不到文件夹 (material-ui/svg-icons/action/),但尝试添加新图标:

I couldn't locate the folder (material-ui/svg-icons/action/), but tried to add a new icon:

import KeyboardArrowRightIcon from 'material-ui/svg-icons/action/keyboard-arrow-right';

然而,这会在编译时产生错误.

However, this generates an error on compiling.

有谁知道我如何添加新图标?或者,为什么这些图标没有明显的导演?

Would anyone know how I could add a new icon? Or, why there is no apparent director for these icons?

推荐答案

您是否尝试先安装依赖项.这是材料图标

Have you tried installing the dependencies first. Here is the link to Material Icons

这篇关于如何在 React 中使用 Material UI 图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆