how to import material ui icons?i met some problems using Material ui icons
Solution 1:
Icons are not part of material-ui/core so it must be install using two commands.
If you are using npm
npm install @material-ui/core
npm install @material-ui/icons
If you are using yarn
yarn add @material-ui/core
yarn add @material-ui/icons
Solution 2:
Solved, the icons module should be added to dependencies. use npm
npm install @material-ui/icons
or use yarn
yarn add @material-ui/icons
Solution 3:
I just solved a strange, ( but not so strange after i found out why) issue
on mac it worked but when i deploy to linux it failed and could not find the icon
this was because on mac it is not case sensitive and linux is
so
import DeleteForEver from '@material-ui/icons/DeleteForEver'
works on mac but fails on linux
the file is actually named like "DeleteForever"
so correct way to import is
import DeleteForever from '@material-ui/icons/DeleteForever'