1
votes

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?

1
Have you done "npm install"?H. Hakvoort
yes, I've already tried "npm install"Nadine
It's import SearchIcon from '@material-ui/icons/SearchFraction
You mention you installed the icons; Did you install it like: @material-ui/core/Icon or @material-ui/icons?minus.273
I installed it like "@material-ui/icons", but the different import method without appending Icon was my mistakeNadine

1 Answers

1
votes

You don't need to append the name with Icon, just use the name i.e. /Search (see examples).