Search code examples
javascriptreactjsjsonmaterial-uimaterial-icons

material-ui search icons is not imported


import React from 'react'
import {Search} from "@material-ui/icons/Search"
const App = () => {
  return (
    <div>
    <Search/>
    </div>
  )
}
export default App

export 'Search' (imported as 'Search') was not found in '@material-ui/icons/Search' (possible exports: __esModule, default)

export 'Search' (imported as 'Search') was not found in '@material-ui/icons/Search' (possible exports: __esModule, default)

search icons is not imported,but i installed material packages and it is not showing in package.json


Solution

  • The correct import is:

    import SearchIcon from '@mui/icons-material/Search';
    

    If you haven't already, you'll have to install

    npm i @mui/icons-material
    

    You can find all of the icons here: https://mui.com/material-ui/material-icons/