简体   繁体   中英

How can I use Icons from material-ui icons?

I want to use an icon inside an iconbutton like this:

<IconButton >
    <SearchIcon/>
</IconButton>

I installed @material-ui/icons in my package.json and have the following imports:

import IconButton from '@material-ui/core/IconButton';
import Icon from '@material-ui/core/Icon';
import SearchIcon from '@material-ui/icons/SearchIcon';

Now I get the error message:

Module not found: Can't resolve '@material-ui/icons/SearchIcon'

Can somebody help me?

您不需要在名称后附加Icon ,只需使用名称 ie /Search (参见示例)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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